
Security News
New CNA Scorecard Tool Ranks CVE Data Quality Across the Ecosystem
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
assure-array
Advanced tools
Wraps a value in an array if it isn't already one. Returns an empty array for null
and undefined
.
A typical usecase for this: when you have an option that accepts multiple values as an array, but you want to make the use of an array literal optional when there's only a single value to specify.
WTFPL or CC0, whichever you prefer. A donation and/or attribution are appreciated, but not required.
Maintaining open-source projects takes a lot of time, and the more donations I receive, the more time I can dedicate to open-source. If this module is useful to you, consider making a donation!
You can donate using Bitcoin, PayPal, Flattr, cash-in-mail, SEPA transfers, and pretty much anything else. Thank you!
Pull requests welcome. Please make sure your modifications are in line with the overall code style, and ensure that you're editing the files in src/
, not those in lib/
.
Build tool of choice is gulp
; simply run gulp
while developing, and it will watch for changes.
Be aware that by making a pull request, you agree to release your modifications under the licenses stated above.
Some examples:
var assureArray = require("assure-array");
assureArray("hello world"); // ["hello world!"]
assureArray(["hello", "world"]); // ["hello", "world"]
assureArray(null); // []
assureArray([true]); // [true]
Ensures that the provided value
is returned as an array.
value
is an array already, this returns the array unchanged.value
is null
or undefined
, this returns an empty array.value
is any other kind of value, this returns a new array containing just that one value.FAQs
Wraps a value in an array if it isn't already one
The npm package assure-array receives a total of 1,687 weekly downloads. As such, assure-array popularity was classified as popular.
We found that assure-array demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.