Skip to content

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

License

Notifications You must be signed in to change notification settings

iamtabrezkhan/native-type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to native-type 👋

Version Documentation Maintenance License: MIT Twitter: TabrezX

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

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published