# power-object

> An object with superpowers!

Latest version **1.1.0** (published 2016-04-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install power-object
pnpm add power-object
yarn add power-object
bun add power-object
```

## 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 | 1.1.0 |
| Published | 2016-04-26 |
| First published | 2016-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | facekapow |
| Maintainers | facekapow |
| Keywords | power, object, super, superpowers, special, utility, utilities |

## Links

- npm: https://www.npmjs.com/package/power-object
- Repository: https://github.com/facekapow/power-object
- Homepage: https://github.com/facekapow/power-object#readme
- Issues: https://github.com/facekapow/power-object/issues
- npm.io page: https://npm.io/package/power-object

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-04-26
- 1.0.0 — 2016-04-24

## README

# power-object
An object with superpowers!

## Superpower report
  * Use objects as keys:
    ```js
    const PowerObject = require('power-object');
    let obj = new PowerObject();

    // objects are always different
    let key1 = {};
    let key2 = {};
    let key3 = new Date(); // even classes (which are technically just objects)

    obj.set(key1, 400);
    obj.set(key2, 500);
    obj.set(key3, 'hi');
    obj.set(3, 'hello'); // numbers aren't stringified

    obj.get(key1); // 400
    obj.get(key2); // 500
    obj.get(key3); // 'hi'
    obj.get(3); // 'hello'
    ```
  * `for...of` iteration:
    ```js
    const PowerObject = require('power-object');
    let obj = new PowerObject();

    let key1 = {};
    let key2 = {};

    obj.set(key1, 'some value');
    obj.set(key2, 89);

    for (let value of obj) console.log(value); // 'some value' then 89
    ```

## Class docs

### new PowerObject([object])
Returns a new PowerObject, optionally creating it from a given object.
Unlike a regular object, you can't get or set a property directly (using `obj[prop]` or `obj.prop`).

#### PowerObject.prototype.get(key)
Retrieves a value from the PowerObject given a key. Unlike a regular Object, this can include Objects and doesn't stringify anything.

#### PowerObject.prototype.set(key, val)
Sets a value on the PowerObject for a given key. Unlike a regular Object, this can include Objects and doesn't stringify anything.

#### PowerObject.prototype.keys()
Returns an array containing the PowerObject's keys.

#### PowerObject.prototype.remove(key)
Removes a property from the PowerObject. Unlike a regular Object, this can include Objects and doesn't stringify anything.

#### PowerObject.prototype.clearAll()
Clears all properties from the PowerObject.

#### PowerObject.prototype[Symbol.iterator]
Returns an Iterator to iterate over the PowerObject's properties. Used by `for...of` to iterate.

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