@jswork/protofill
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

protofill

Enhance native JavaScript prototypes with custom methods safely.

version license size download

installation

npm install @jswork/protofill

# add types for `src/global.d.ts`
import '@jswork/protofill/dist/types';

usage

// just oneline
import '@jswork/protofill'

// ------ Array ---- 
const arr = [1,2,3]

// set/get first: 
arr.first = 'a';
arr.first;

// set/get last: 
arr.last = 'a';
arr.last;

// filter2tuple
const numbers = [1, 2, 3, 4, 5];
const result = numbers.filter2tuple((item) => item > 2);
// result: [[3, 4, 5], [1, 2, 3, 4, 5]]

// ------ Date ----
const date = new Date();
format: date.format('YYYY-MM-DD HH:mm:ss');

license

Code released under the MIT license.

Package Sidebar

Install

npm i @jswork/protofill

Homepage

js.work

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

10.7 kB

Total Files

18

Last publish

Collaborators

  • afeiship