0.0.5 ā¢ Published 4 years ago
native-type v0.0.5
Use this package to detect object class or native type in JavaScript.
š Homepage
Install
npm install native-type
Usage
const getNativeType = require("native-type");
getNativeType(""); // ==> 'string'
getNativeType(123); // ==> 'number'
getNativeType({}); // ==> 'object'
getNativeType([]); // ==> 'array'
getNativeType(undefined); // ==> 'undefined'
getNativeType(new Date()); // ==> 'date'
getNativeType(new Map()); // ==> 'map'
getNativeType(new Set()); // ==> 'set'
getNativeType(new Promise(() => {})); // ==> 'promise'
getNativeType(null); // ==> 'null'
getNativeType(9n); // ==> 'bigint'
getNativeType(Symbol) // ==> function
getNativeType(() => {}), // ==> "function"
getNativeType(Symbol.iterator // ==> symbol
More examples here
Run tests
npm run test
Author
š¤ Tabrez Khan (https://github.com/iamtabrezkhan)
- Website: https://iamtabrezkhan.github.io
- Twitter: @TabrezX
- Github: @iamtabrezkhan
- LinkedIn: @iamtabrezkhan
š¤ Contributing
Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.
Show your support
Give a āļø if this project helped you!
š License
Copyright Ā© 2020 Tabrez Khan (https://github.com/iamtabrezkhan). This project is MIT licensed.
This README was generated with ā¤ļø by readme-md-generator