centerjs

1.0.0 • Public • Published

center-js

CenterJS is a framework for NPM scripts with JS or ECMAScript.

CenterJS includes obsolete builds for core-js if you would rather install that way.

NPM installation

CenterJS is on NPM for your Javascript scripts and ECMAScript. Run the following code in a desired directory.

npm i center-js

CenterJS is up and ready.

Example of usage:

import 'center-js'; // <- at the top of your entry point

Array.from(new Set([1, 2, 3, 2, 1]));          // => [1, 2, 3]
[1, [2, 3], [4, [5]]].flat(2);                 // => [1, 2, 3, 4, 5]
Promise.resolve(32).then(x => console.log(x)); // => 32

You can load only required features:

import 'center-js/features/array/from'; // <- at the top of your entry point
import 'center-js/features/array/flat'; // <- at the top of your entry point
import 'center-js/features/set';        // <- at the top of your entry point
import 'center-js/features/promise';    // <- at the top of your entry point

Array.from(new Set([1, 2, 3, 2, 1]));          // => [1, 2, 3]
[1, [2, 3], [4, [5]]].flat(2);                 // => [1, 2, 3, 4, 5]
Promise.resolve(32).then(x => console.log(x)); // => 32

Or use it without global namespace pollution:

import from from 'center-js-pure/features/array/from';
import flat from 'center-js-pure/features/array/flat';
import Set from 'center-js-pure/features/set';
import Promise from 'center-js-pure/features/promise';

from(new Set([1, 2, 3, 2, 1]));                // => [1, 2, 3]
flat([1, [2, 3], [4, [5]]], 2);                // => [1, 2, 3, 4, 5]
Promise.resolve(32).then(x => console.log(x)); // => 32

Readme

Keywords

none

Package Sidebar

Install

npm i centerjs

Weekly Downloads

44

Version

1.0.0

License

MIT

Unpacked Size

2.14 MB

Total Files

2327

Last publish

Collaborators

  • flarehq