abbrev-kindof
kind-of
with single letter abbreviations to javascript native types, like kindof(val, 'soa')
will return true if val
is string, object or array. useful for DB/Schema/Object validations
Install
npm i abbrev-kindof --save
npm test
Usage
For more use-cases see the tests
abbrevKindof(123, 'soa');
abbrevKindof(['foo', 'bar'], 'soa');
abbrevKindof('foo bar', 'soa');
abbrevKindof({foo: 'bar'}, 'soa');
Possible abbreviations
a
for array
b
for boolean
f
for function
n
for number
o
for object
r
for regexp
s
for string
y
for symbol
Related
- assert-kindof: Check native type of the given value and throw TypeError if not okey. Expressive, elegant, behavior-driven API, good descriptive default error messages, simple and clean syntax.
- is-kindof: Thin wrapper around
kind-of
and in bonus functional api. - kind-of: Get the native type of a value.
- map-types: Map single letter abbreviations to javascript native types. Useful as a shorthand for pseudo-argument destructuring when debugging.