open-index/open-npm huggingface dataset:
npm package: @obedm503/self
Description: just use self. adds self to environments that don't already have it.
Author: obedm503
Latest version: 1.0.1

# self

Given the [troubles](https://github.com/tc39/proposal-global/issues/32) with adding a common global reference in the spec, just use `self`. `self` already exists in browser and worker environments. This script just adds a circular reference to the already existing global in the form of `self` if it's not already there.

This package was inspired by @pluma's comments [here](https://github.com/tc39/proposal-global/issues/32#issuecomment-443280846) and [here](https://github.com/tc39/proposal-global/issues/32#issuecomment-443291102) about `self` being a red herring. Although `self` is not as pretty as `global`, it works.

## usage

```js
// universal js code
require('@obedm503/self');

self.console.log(self.self === self); // true
```