Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

native-type

iamtabrezkhan3MIT0.0.5

Use this package to detect object class or native type in JavaScript.

native, type, javascript, object, class, primitive

readme

Welcome to native-type 👋

Version Documentation Maintenance License: MIT Twitter: TabrezX

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)

🤝 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