Get the native JavaScript type of a value, preceded by the appropriate indefinite article (either `a` or `an`), for use in error messages.
Installations
npm install typeof-article
Releases
Unable to fetch releases
Developer
jonschlinkert
Developer Guide
Module System
CommonJS
Min. Node Version
>=4
Typescript Support
No
Node Version
6.9.2
NPM Version
3.10.9
Statistics
7 Stars
4 Commits
1 Forks
4 Watching
2 Branches
2 Contributors
Updated on 12 Apr 2021
Bundle Size
2.26 kB
Minified
846.00 B
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
54,145,546
Last day
-16.8%
47,080
Compared to previous day
Last week
-3.6%
300,275
Compared to previous week
Last month
1.8%
1,318,937
Compared to previous month
Last year
11%
14,358,698
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
2
typeof-article
Get the native JavaScript type of a value, preceded by the appropriate indefinite article (either
a
oran
), for use in error messages.
Install
Install with npm:
1$ npm install --save typeof-article
Usage
(A few of the types have some extra formatting where it makes sense. For example, instead of a regexp
, it returns a regular expression
, which IMHO is more readable to users. You can customize mappings if you want)
1var type = require('typeof-article'); 2 3console.log(type({})); 4//=> 'an object' 5 6console.log(type([])); 7//=> 'an array' 8 9console.log(type(9)); 10//=> 'a number' 11 12console.log(type(/abc/)); 13//=> 'a regular expression' 14 15console.log(type(new WeakMap())); 16//=> 'a WeakMap'
Get the object of types-to-articles mappings:
1var types = require('typeof-article').types;
Also exposes a typeOf
property, for getting the native type only:
1var type = require('typeof-article'); 2type.types.weapmap = 'a WeakMap()'; 3 4console.log(type.typeOf(new WeakMap())); 5//=> 'weakmap'
Customize
Customize any of the mappings:
1var type = require('typeof-article'); 2type.types.weapmap = 'a WeakMap()'; 3 4console.log(type(new WeakMap())); 5//=> 'a WeakMap()'
About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
Building docs
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
1$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running tests
Install dev dependencies:
1$ npm install && npm test
Author
Jon Schlinkert
License
Copyright © 2017, Jon Schlinkert. MIT
This file was generated by verb-generate-readme, v0.4.2, on January 30, 2017.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/4 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Score
3
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More