Gathering detailed insights and metrics for typeof-article
Gathering detailed insights and metrics for typeof-article
Gathering detailed insights and metrics for typeof-article
Gathering detailed insights and metrics for typeof-article
Get the native JavaScript type of a value, preceded by the appropriate indefinite article (either `a` or `an`), for use in error messages.
npm install typeof-article
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
7 Stars
4 Commits
1 Forks
4 Watching
2 Branches
2 Contributors
Updated on 12 Apr 2021
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
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
1
2
Get the native JavaScript type of a value, preceded by the appropriate indefinite article (either
a
oran
), for use in error messages.
Install with npm:
1$ npm install --save typeof-article
(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 any of the mappings:
1var type = require('typeof-article'); 2type.types.weapmap = 'a WeakMap()'; 3 4console.log(type(new WeakMap())); 5//=> 'a WeakMap()'
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.
(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
Install dev dependencies:
1$ npm install && npm test
Jon Schlinkert
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
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
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Score
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