<commit_before># Archetype
Restore overwritten methods on the window.

[![Build Status](https://travis-ci.org/perry-mitchell/archetype.svg)](https://travis-ci.org/perry-mitchell/archetype)

## Picking up the pieces
Libraries like Prototype.js do immeasureable harm to the shared environments that are webpages. 3rd party libraries - like those used in tracking and advertising scripts - must ensure that they can cope with whatever broken system is presented to them. Libraries like Prototype assume that what they add is for the benefit of the developer and that single website, and that the extensions they provide won't harm existing functionality - but that's obviously incorrect, and Archetype is here to fix those problems in a simple manner.

### What it does
Archetype provides access to original window methods that may have been overwritten by some script.

### How it does it
The library uses an iframe to create a clean environment in which to extract methods from. When a function is requested from archetype, the main window is checked for a native function - if that function is not native, a native version will be taken from within an iframe, bound to the top-level and returned.

## API

### getNativeMethod(path)
Fetches a native window method at a given path. A path is simply the string representation of a method's location on the window: eg. window.setInterval.
<commit_msg>Wording<commit_after># archetype
Restore overwritten methods on the window.

[![Build Status](https://travis-ci.org/perry-mitchell/archetype.svg)](https://travis-ci.org/perry-mitchell/archetype) [![archetype is on Bower](https://badge.fury.io/bo/archetype.svg)](https://github.com/perry-mitchell/archetype)

## Making repairs
Libraries like Prototype.js do immeasureable harm to the shared environments that are webpages. 3rd party libraries - like those used in tracking and advertising scripts - must ensure that they can cope with whatever broken system is presented to them. Libraries like Prototype assume that what they add is for the benefit of the developer and that single website, and that the extensions they provide won't harm existing functionality - but that's obviously incorrect, and Archetype is here to fix those problems in a simple manner.

### What it does
Archetype provides access to original window methods that may have been overwritten by some script.

### How it does it
The library uses an iframe to create a clean environment in which to extract methods from. When a function is requested from archetype, the main window is checked for a native function - if that function is not native, a native version will be taken from within an iframe, bound to the top-level and returned.

## API

### getNativeMethod(path)
Fetches a native window method at a given path. A path is simply the string representation of a method's location on the window: eg. window.setInterval.

{'fraction_non_alphanumeric': 0.05737988247493951, 'fraction_numerical': 0.000691323885240235, 'mean_word_length': 4.674509803921569, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '846416', 'n_tokens_mistral': 724, 'n_tokens_neox': 709, 'n_words': 402}