# @jswork/protofill

> Enhance native JavaScript prototypes with custom methods safely.

Latest version **1.0.7** (published 2023-09-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jswork/protofill
pnpm add @jswork/protofill
yarn add @jswork/protofill
bun add @jswork/protofill
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2023-09-07 |
| First published | 2023-08-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | afeiship |
| Keywords | enhance, javascript, js, prototype, safely |

## Links

- npm: https://www.npmjs.com/package/@jswork/protofill
- Homepage: https://js.work
- npm.io page: https://npm.io/package/@jswork/protofill

## Dependencies (2)

- [@jswork/filter2tuple](https://npm.io/package/@jswork/filter2tuple.md) ^1.0.4
- [@jswork/simple-date-format](https://npm.io/package/@jswork/simple-date-format.md) ^1.0.4

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.7 (latest) — 2023-09-07
- 1.0.6 — 2023-08-14
- 1.0.5 — 2023-08-14
- 1.0.4 — 2023-08-10
- 1.0.3 — 2023-08-10
- 1.0.2 — 2023-08-10
- 1.0.1 — 2023-08-10

## README

# protofill
> Enhance native JavaScript prototypes with custom methods safely.

[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
npm install @jswork/protofill

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

## usage
```js
// 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](https://github.com/afeiship/protofill/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/protofill
[version-url]: https://npmjs.org/package/@jswork/protofill

[license-image]: https://img.shields.io/npm/l/@jswork/protofill
[license-url]: https://github.com/afeiship/protofill/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/protofill
[size-url]: https://github.com/afeiship/protofill/blob/master/dist/protofill.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/protofill
[download-url]: https://www.npmjs.com/package/@jswork/protofill

---
_Source: https://npm.io/package/@jswork/protofill · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
