# redefine-statics-js

> Utility function that copies-over all static methods of a child object to the parent object.

Latest version **2.0.2** (published 2018-12-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install redefine-statics-js
pnpm add redefine-statics-js
yarn add redefine-statics-js
bun add redefine-statics-js
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2018-12-09 |
| First published | 2018-09-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | April Mintac Pineda |
| Maintainers | aprilmintacpineda |
| Keywords | static-properties, hoc, higher-order-components, higher-order-functions |

## Links

- npm: https://www.npmjs.com/package/redefine-statics-js
- Repository: git@gh_personal:aprilmintacpineda/redefine-statics-js
- npm.io page: https://npm.io/package/redefine-statics-js

## Recent versions

- 2.0.2 (latest) — 2018-12-09
- 2.0.1 — 2018-11-02
- 2.0.0 — 2018-10-13
- 1.1.2 — 2018-09-16
- 1.1.1 — 2018-09-16
- 1.1.0 — 2018-09-16
- 1.0.2 — 2018-09-16
- 1.0.1 — 2018-09-16
- 1.0.0 — 2018-09-16

## README

<!-- @format -->

# redefine-statics-js

Utility function that copies-over all static methods of a child object to the parent object.

# The problem

**This utility solves**: The problem is that when we have a class and we wrap it inside a `higher-order-function`, the static methods of the wrapped class should be copied to the `higher-order-class` (the class returned by the `higher-order-function`).

# Usage

`npm i -s redefine-statics-js`.

Then on your wrapper:

```js
import redefineStatics from 'redefine-statics-js';

function MyWrapper(WrappedClass) {
  class MyWrapperClass {
    // some methods here.
  }

  redefineStatics(MyWrapperClass, WrappedClass);

  return MyWrapperClass;
}
```

Then on the wrapped class:

```js
class WrappedObject {
  static myStaticMethod() {}
}

export default MyWrapper(WrappedObject);
```

Now the export of the wrapped class would have `myStaticMethod` in it.

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