Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
arrayiffy-if-string
Advanced tools
Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
npm i arrayiffy-if-string
The default is exported, so instead of "arrayiffy
" below, you can name the consumed function however you want.
Consume via a require()
:
const arrayiffy = require("arrayiffy-if-string");
or as an ES Module:
import arrayiffy from "arrayiffy-if-string";
or for web pages, as a production-ready minified script file (so-called "UMD build"), straight from CDN:
<script src="https://cdn.jsdelivr.net/npm/arrayiffy-if-string/dist/arrayiffy-if-string.umd.js"></script>
// in which case you get a global variable "arrayiffyIfString" which you consume like this:
const arrayiffy = arrayiffyIfString;
This package has three builds in dist/
folder:
Type | Key in package.json | Path | Size |
---|---|---|---|
Main export - CommonJS version, transpiled to ES5, contains require and module.exports | main | dist/arrayiffy-if-string.cjs.js | 518 B |
ES module build that Webpack/Rollup understands. Untranspiled ES6 code with import /export . | module | dist/arrayiffy-if-string.esm.js | 501 B |
UMD build for browsers, transpiled, minified, containing iife 's and has all dependencies baked-in | browser | dist/arrayiffy-if-string.umd.js | 555 B |
const arrayiffy = require("arrayiffy-if-string");
var res = arrayiffy("aaa");
console.log("res = " + JSON.stringify(res, null, 4));
// => ['aaa']
const arrayiffy = require("arrayiffy-if-string");
var res = arrayiffy("");
console.log("res = " + JSON.stringify(res, null, 4));
// => []
const arrayiffy = require("arrayiffy-if-string");
var res = arrayiffy(true);
console.log("res = " + JSON.stringify(res, null, 4));
// => true
It's main purpose is to prepare the input argument options' objects. Check out check-types-mini
on npm, or on GitLab.
In monorepo, npm libraries are located in packages/
folder. Inside, the source code is located either in src/
folder (normal npm library) or in the root, cli.js
(if it's a command-line application).
The npm script "dev
", the "dev": "rollup -c --dev"
builds the development version retaining all console.log
s with row numbers. It's handy to have js-row-num-cli installed globally so you can automatically update the row numbers on all console.log
s.
MIT License
Copyright (c) 2015-2020 Roy Revelt and other contributors
FAQs
Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
We found that arrayiffy-if-string demonstrated a healthy version release cadence and project activity because the last version was released less than 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
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.