1.0.7 • Published 5 years ago
@huzapi/component-type v1.0.7
#Huz Api / Component Type
Handles primitive/scalar types as plain, array or map
Test (100% TDD)
npm test
Install to your project
npm i @huzapi/component-type
##Import
const {ArrayType, ObjectType} = require('@huzapi/component-type');##Members
AnyType
- todo
ArrayType
| Info | Call | Result |
|---|---|---|
| cast undefined | .cast(undefined) | [] |
| cast null | .cast(null) | [] |
| cast plain Object | .cast({a:5,b:'foo'}) | [5,'foo'] |
| cast plain number | .cast(-5) | [-5] |
| cast plain boolean | .cast(false) | [false] |
| cast plain string | .cast('foo') | ["foo"] |
| cast JSON | .cast('["bar"]') | ["bar"] |
| cast plain Function | .cast(() => '[false]') | [false] |
| Unique | .unique([1,1,2,2]) | [1,2] |
| Shuffle | .shuffle([1,2,3,4,5]) | [3,5,1,2,4] |
BoolType
- todo
CodeType
- todo
DateType
- todo
FloatType
- todo
FunctionType
- todo
IntType
- todo
IsoDatetimeType
- todo
IsoDateType
- todo
IsoTimeType
- todo
MomentType
- todo
NamerType
- todo
ObjectType
- todo
RegExpType
- todo
StringType
- todo
UuidType
- todo