# objextender

> Extends the Object Class(or any object) Prototype safely using ES6 Symbols

Latest version **0.0.3** (published 2016-09-07) · MIT license · 0 weekly downloads

## Install

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

## 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.0.3 |
| Published | 2016-09-07 |
| First published | 2016-08-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nick The Sick |
| Maintainers | nperez0111 |
| Keywords | object, prototype, extend |

## Links

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

## Dependencies (4)

- [map-obj](https://npm.io/package/map-obj.md) ^1.0.1
- [is-object](https://npm.io/package/is-object.md) ^1.0.1
- [is-function](https://npm.io/package/is-function.md) ^1.0.1
- [is-in-correct-format](https://npm.io/package/is-in-correct-format.md) ^0.0.3

## Recent versions

- 0.0.3 (latest) — 2016-09-07
- 0.0.2 — 2016-08-30
- 0.0.1 — 2016-08-30

## README

# objExtender [![Build Status](https://travis-ci.org/nperez0111/objExtender.svg?branch=master)](https://travis-ci.org/nperez0111/objextender)

> Extends the Object Prototype safely using ES6 Symbols

## Install

```
$ npm install --save objextender
```


## Usage

```js
const extend = require( 'objextender' );

let get = extend( {

    keys: function () {

        return Object.keys( this )

    }

} )

let x = {
    a: 1,
    b: 2
}

x[ get.keys ]()
//=> [ 'a', 'b' ]
```


## API

### objextender(input, [options])

#### input

Type: `object`

`input` must be in a format where the values of any given key is a `function`

#### options

##### getHelperMethod

Type: `boolean`<br>
Default: `true`

This allows you to choose whether you would like the provided get helper method which allows you to do this:

```js
let please = extend( {

    grabX: function ( get ) {

        return get( 'x' );

    }

} )

let y = {
    x: 34
}

y[ please.grabX ]()
//=> 34
```
##### toExtend

Type: `object(but really a class)`<br>
Default: `Object (the class)`

This allows you to choose what object you would like to be extending the prototype of safely. Like so:

```js
let classyClass = function () {
        this.x = 'magic'
    };

let please = fn( {
        grabX: function ( get ) {
            return get( 'x' );
        }
    }, {
        toExtend: classyClass
    } )
    
let objectOfClass = new classyClass();
    
objectOfClass[ please.grabX ]()
//=> 'magic'
```



## License

MIT © [Nick The Sick](http://nickthesick.com)

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