@undercut/web-2019

0.6.1 • Public • Published

@undercut/web-2019

downloads circleci codecov license

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.

Lazy data processing, pipelines, and language utilities built around native JS features and protocols.

  • Based on existing JS protocols and language features
  • Balanced API: not too imperative, not too functional
  • Various language utilities to use as a Standard Library
  • Composability and extensibility by design
  • Custom operations in a couple of lines
  • Lazy evaluation when possible
  • No external dependencies
  • TypeScript in JSDoc

Please visit undercut.js.org for broader overview and documentation.

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 */
});

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)); // true
console.log(isNumberValue("hello")); // false
console.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
# or
yarn 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.

License

Licensed under the MIT License, see LICENSE for more information.

Package Sidebar

Install

npm i @undercut/web-2019

Weekly Downloads

6

Version

0.6.1

License

MIT

Unpacked Size

248 kB

Total Files

9

Last publish

Collaborators

  • spyke