1.0.0 • Published 5 years ago

@mazzard/classes v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

#@mazzard/classes

Install

npm i @mazzard/classes

Next we will use classes which means we imported it from @mazzard/classes

import classes from '@mazzard/classes'
classes() // ''

string

String is conveying as is

classes('test') // 'test' 

function

Function is calling

classes(() => 'test1') // 'test1'
classes(() => () => 'test1') // 'test1'
classes(() => () => () => 'test1') // 'test1'

iterable

Any iterable elements are sorting out and combining each other

classes([]) // ''
classes(['test1', 'test2', 'test3']) // 'test1 test2 test3'
classes(new Set(['test1', 'test2', 'test3'])) // 'test1 test2 test3'
classes(new Map([['test1', ''], ['test2', ''], ['test3', 'test4']])) // 'test1 test2 test3 test4'

object

Any object are filtering by value and combining their's keys

classes({}) // ''
classes({
  test1: true,
  test2: false
}) // 'test1'
classes({
  test1: true,
  test2: true
}) // 'test1 test2'

other

other types returns empty string

classes(null) // ''
classes(undefined) // ''
classes(Symbol('test')) // ''
classes(1) // ''
classes(1.1) // ''
classes(NaN) // ''

combining

You may combine all of this types as you wish

classes(
  'test1',
  () => 'test2',
  () => [
    new Set(['test3']),
    () => ({
      test4: true,
      test5: false
    })
  ]
) // 'test1 test2 test3 test4'