# repair

> Repair broken instances of native constructors.

Latest version **0.1.1** (published 2015-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install repair
pnpm add repair
yarn add repair
bun add repair
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2015-08-25 |
| First published | 2015-08-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Martijn Swaagman |
| Maintainers | swaagie |
| Keywords | repair, native, instances, regexp, references, vm, context |

## Links

- npm: https://www.npmjs.com/package/repair
- Repository: https://github.com/Swaagie/repair
- Homepage: https://github.com/Swaagie/repair#readme
- Issues: https://github.com/Swaagie/repair/issues
- npm.io page: https://npm.io/package/repair

## Recent versions

- 0.1.1 (latest) — 2015-08-25
- 0.1.0 — 2015-08-11
- 0.0.1 — 2015-08-11

## README

# Repair

[![Version npm][version]](http://browsenpm.org/package/repair)[![Build Status][build]](https://travis-ci.org/Swaagie/repair)[![Dependencies][david]](https://david-dm.org/Swaagie/repair)[![Coverage Status][cover]](https://coveralls.io/r/Swaagie/repair?branch=master)

[version]: http://img.shields.io/npm/v/repair.svg?style=flat-square
[build]: http://img.shields.io/travis/Swaagie/repair/master.svg?style=flat-square
[david]: https://img.shields.io/david/Swaagie/repair.svg?style=flat-square
[cover]: http://img.shields.io/coveralls/Swaagie/repair/master.svg?style=flat-square

Repair broken instances of native JS constructors, making `instanceof` work!
Running code in different VMs will break the instance's reference.
Simply pass an instance or collection of instances to repair and `instanceof`
checks will run again. Although this sounds silly, consider a configuration
with multiple `RegExp` instances or dependencies that assume `instanceof`
checks to work.

### Install

```
npm install --save repair
```

### Example

```
var repair = require('repair')
  , vm = require('vm')
  , config = {};

vm.createContext(config);
vm.runInContext('date=new Date', config);

assert.equal(config.date instanceof Date, true, 'Different instance');
assert.equal(repair(config.date) instanceof Date, true);
```

### License

MIT

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