kind-of
with single letter abbreviations to javascript native types, like kindof(val, 'soa')
will return true if val
is string, object or array.
Install
npm i --save abbrev-kindof
npm test
Usage
For more use-cases see the tests
var abbrevKindof = require('abbrev-kindof');
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.
Author
Charlike Mike Reagent
License
Copyright (c) 2015 Charlike Mike Reagent, contributors.
Released under the MIT
license.
Proudly generated by docks(1), May 4, 2015