# proto-forge

> Small library for instrumenting Object.defineProperties and creating reusable prototypes.

Latest version **1.1.0** (published 2015-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install proto-forge
pnpm add proto-forge
yarn add proto-forge
bun add proto-forge
```

## 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 | 2015-08-09 |
| First published | 2015-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Krzysztof Winiarski |
| Maintainers | kwiniarski |
| Keywords | object, prototype, factory |

## Links

- npm: https://www.npmjs.com/package/proto-forge
- Repository: https://github.com/kwiniarski/proto-forge
- Homepage: https://github.com/kwiniarski/proto-forge#readme
- Issues: https://github.com/kwiniarski/proto-forge/issues
- npm.io page: https://npm.io/package/proto-forge

## Dependencies (1)

- [object-assign](https://npm.io/package/object-assign.md) ^3.0.0

## Recent versions

- 1.1.0 (latest) — 2015-08-09
- 1.0.1 — 2015-08-08

## README

# proto-forge

> Small library for instrumenting `Object.defineProperties` and creating reusable prototypes.

What does it mean? **proto-forge** aim is to provide markup convention for objects, which will create instrumentation for `Object.defineProperty`. This includes:

* creating getters/setters form set/get methods;
* setting `enumerated` property depending on presence of `_` sign;



## Installation

`npm install proto-forge`

## Usage

### Basic example

```js
proto.forge({
	_id: 1
	basePath: null,
	assign() {
	},
	getPath() {
	},
	getParent() {
	},
	setParent(value) {
	}
});
```

will create object:

```js
{
	basePath: null,
	assign: [Function],
	path: [Getter],
	parent: [Getter/Setter],
}
```

As you can see, all methods beginning with set or get where used to create getter/setter properties. For example `getParent` and `setParent` where used to create `parent` property. Source methods became not enumerable, however they are still accessible. Another example is `_id` property. Because it starts with underscore it became not enumerable. This way you can control how destination object is created.

## License

Copyright (c) 2015 Krzysztof Winiarski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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