1.0.0 • Published 4 years ago

centerjs v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

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