# obj-spread

> My very own functions for array manipulation, called `arra`

Latest version **1.0.23** (published 2021-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install obj-spread
pnpm add obj-spread
yarn add obj-spread
bun add obj-spread
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.23 |
| Published | 2021-08-30 |
| First published | 2021-06-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shalmu |
| Maintainers | shalmu |

## Links

- npm: https://www.npmjs.com/package/obj-spread
- npm.io page: https://npm.io/package/obj-spread

## Recent versions

- 1.0.23 (latest) — 2021-08-30
- 1.0.19 — 2021-07-22
- 1.0.17 — 2021-06-01
- 0.0.12 — 2021-06-01

## README

<!---
To create this package, I read this cool article: https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c

In a nutshell, to publish:

* increase the version in package.json
* `npm test`
* `npm publish` - this will also run the `npm prepare` before publishing

If it requests login, do `npm login` and try again

-->

A simple, but powerful way to extend classes with other classes. You can even extend built-in classes, like `Array` or `String`

# Installation

`npm i obj-spread -S`

# Usage

For example, you want to move all static functions from class `Foo` to internal class `String`. All you need to do is
to create an instance of ObjSpread:

```ts
    new ObjSpread(Foo, String, s=>String(s));
```
Here, the last argument will convert the value to an actual `String` class.
For example, if you want to spread to `Array`, you would do the following:
```ts
    new ObjSpread(Foo, Array, a=>[].concat(a));
```
In case if you don't need to convert anything, just do `a=>a`.

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