Reduces list of anything that looks like classname to single space-separated string.
NB: Allows
/[\w-]/
only in classnames. Classnames with other characters will be excluded from resulting list.
Symbol.prototype.description
(optional),Reflect
(optional).
If you don’t use symbols (lolol) or numbers (lol), you can use -no-symbols
or -no-numbers
.
classlist() // ''
classlist(null) // ''
classlist('') // ''
classlist('ты пидор') // ''
classlist(1488) // '1488'
classlist(1488n) // '1488n'
classlist('ti pidor') // 'ti pidor'
classlist('ti.pidor') // 'ti pidor'
classlist(Symbol('ti.pidor')) // 'ti pidor'
classlist(['ti', 'pidor']) // 'ti pidor'
classlist({ ti: 'pidor' }) // 'ti pidor'
classlist({ ti: true, nyasha: false, pidor: true }) // 'ti pidor'
classlist({ ti: { pidor: true } }) // 'ti pidor'
DON’T BE A DICK PUBLIC LICENSE
Version 1, July 2019
Copyright © 2019 Marina Miyaoka [email protected]
- Don’t be a dick.
- If you are, get in the damn robot.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.