Skip to main content

Precompiled packages

@undercut/node#

A precompiled version of the Undercut packages for Node.js 12.17 LTS and upward. Contains pull, push, and utils entries. An easy way to try Undercut when your project has no build step or you're doing a quick experiment.

Usage#

Usage is similar to the original ESM packages.

const { pullArray, filter, map, skip } = require("@undercut/node/pull");
const source = [1, 2, 3, 4, 5, 6, 7];
const result = pullArray([    skip(2),    filter(x => x % 3),    map(x => x * 2) // Will be executed only 3 times.], source);
console.log(result); // [8, 10, 14]
const { isNumberValue } = require("@undercut/node/utils");
console.log(isNumberValue(123)); // trueconsole.log(isNumberValue("hello")); // falseconsole.log(isNumberValue(NaN)); // false

Prerequisites#

You may need to import core-js@3 (or another similar polyfill) before you import Undercut:

// index.jsrequire("core-js/es");

Installation#

npm install @undercut/node# oryarn add @undercut/node

You may also try Yarn aliases for convenience:

yarn add undercut@npm:@undercut/node

Updating#

If you're upgrading @undercut/node to a newer version, please upgrade core-js to the latest version too.

@undercut/web-2019#

A precompiled version of the Undercut packages for web browsers not older than 2019-01-01. Contains pull, push, and utils entries. An easy way to try Undercut when your project has no build step or you're doing a quick experiment.

Usage#

Usage is similar to the original ESM packages.

Import desired entry first:

// When using as a script tag and its global variable:const { pullArray, filter, map, skip } = undercut.pull;// When using as a CommonJS module:const { pullArray, filter, map, skip } = require("@undercut/web-2019/pull");// When using as an AMD module:require(["scripts/undercut/pull.js"], function ({ pullArray, filter, map, skip }) {    /* Your code */});

* There're example HTML pages in the repository.

And then use it in your code:

const source = [1, 2, 3, 4, 5, 6, 7];
const result = pullArray([    skip(2),    filter(x => x % 3),    map(x => x * 2) // Will be executed only 3 times.], source);
console.log(result); // [8, 10, 14]
console.log(isNumberValue(123)); // trueconsole.log(isNumberValue("hello")); // falseconsole.log(isNumberValue(NaN)); // false

Prerequisites#

You need to import core-js@3 (or another similar polyfill) before you import Undercut:

<!-- index.html --><script src="https://unpkg.com/core-js-bundle@^3/minified.js"></script>

Installation#

Install the npm package if you're using some kind of a bundler:

npm install @undercut/web-2019# oryarn add @undercut/web-2019

Or use the unpkg CDN to import scripts by their URLs:

<script src="https://unpkg.com/@undercut/web-2019/pull.js"></script><script src="https://unpkg.com/@undercut/web-2019/push.js"></script><script src="https://unpkg.com/@undercut/web-2019/utils.js"></script>

You may also try Yarn aliases for convenience:

yarn add undercut@npm:@undercut/web-2019

Updating#

If you're upgrading @undercut/web-2019 to a newer version, please upgrade core-js to the latest version too.