# untouched

> get pristine copies of built-in objects (like Array or JSON) even if they've been modified

Latest version **0.1.0** (published 2016-02-20) · Unlicense license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-02-20 |
| First published | 2016-02-20 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Evan Hahn |
| Maintainers | evanhahn |
| Keywords | untouched, pristine, original, native |

## Links

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

## Recent versions

- 0.1.0 (latest) — 2016-02-20

## README

untouched
=========

Get pristine copies of built-in objects (like `Array` or `JSON`), even if they've been modified. This is generally for library authors who find themselves in monkey-patched browser environments.

*Currently only made for browsers. Feel free to submit a Node patch with the `vm` module!*

Here's an example:

```js
// Let's say that someone has messed with the Array prototype.
// If you try to use it, you're screwed!
Array.prototype.map = function () {
  return 'this no longer works'
}

// This will return 'this no longer works'!
var arr = [1, 2, 3]
arr.map(function (n) {
  return n * n
})

// With untouched, you can get around this problem.
// This returns what you expect!
var myUntouched = untouched()
var untouchedArr = new myUntouched('Array')(1, 2, 3)
untouchedArr.map(function (n) {
  return * n
})

// You can use it for things other than Array, too.
var untouchedJson = myUntouched('JSON')
untouchedJson.stringify({ hi: 5 })
```

We accomplish this by creating a hidden `<iframe>` and pulling variables out of it. You can remove the iframe whenever you're done with it:

```js
myUntouched.destroy()
```

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