Skip to content

davalapar/vartype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vartype

classify variable types with precision

yarn add @davalapar/vartype
const vartype = require('@davalapar/vartype');
vartype(value <Any>, strict? <Boolean>) : <String>

Loose mode (default)

vartype(value);
  • null, array, object
  • number, nan, infinity
  • undefined, boolean, string, bigint, symbol, function

Strict mode

vartype(value, true);
  • everything in loose mode, plus:
    • integer, float, double
    • error, date, regexp
    • map, set, weakmap, weakset
    • dataview, arraybuffer, sharedarraybuffer
  • including typed arrays
    • int8array, uint8array, uint8clampedarray
    • int16array, uint16array, int32array, uint32array
    • float32array, float64array, bigint64array, biguint64array

References

License

MIT | @davalapar