# @ganuz/define-property

> Define Property is package from Ganuz library

Latest version **0.1.1** (published 2019-04-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ganuz/define-property
pnpm add @ganuz/define-property
yarn add @ganuz/define-property
bun add @ganuz/define-property
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-04-16 |
| First published | 2019-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 156.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Yisrael Eliev |
| Maintainers | yisraelx |
| Keywords | descriptor, descriptors, modular, modules, ponyfill, properties, property, reflect, reflection, utilities, utils |

## Links

- npm: https://www.npmjs.com/package/@ganuz/define-property
- Repository: https://github.com/yisraelx/ganuz
- Homepage: https://github.com/yisraelx/ganuz#readme
- Issues: https://github.com/yisraelx/ganuz/issues
- npm.io page: https://npm.io/package/@ganuz/define-property

## Dependencies (5)

- [@pakal/tryify](https://npm.io/package/@pakal/tryify.md) ^0.2.1
- [@pakal/type-of](https://npm.io/package/@pakal/type-of.md) ^0.2.1
- [@pakal/get-global](https://npm.io/package/@pakal/get-global.md) ^0.2.1
- [@pakal/is-type-of](https://npm.io/package/@pakal/is-type-of.md) ^0.2.1
- [@ganuz/is-property-descriptor](https://npm.io/package/@ganuz/is-property-descriptor.md) ^0.1.1

## Recent versions

- 0.1.1 (latest) — 2019-04-16
- 0.1.0 — 2019-04-02

## README

# @ganuz/define-property
[![Source Code](https://img.shields.io/badge/%3C%2F%3E-source_code-blue.svg)](https://github.com/yisraelx/ganuz/blob/master/modules/define-property)
[![Version](https://img.shields.io/npm/v/@ganuz/define-property.svg)](https://www.npmjs.com/package/@ganuz/define-property)
[![MIT License](https://img.shields.io/npm/l/@ganuz/define-property.svg?color=yellow)](https://github.com/yisraelx/ganuz/blob/master/LICENSE)
[![Bundle Size](https://img.shields.io/bundlephobia/min/@ganuz/define-property.svg?color=green)](https://bundlephobia.com/result?p=@ganuz/define-property)
[![TypeScript](https://img.shields.io/badge/100%25-TypeScript-blue.svg)](https://www.typescriptlang.org)

**Define Property is package from Ganuz library**

## Install
```sh
$ yarn add @ganuz/define-property
```
Or
```sh
$ npm install --save @ganuz/define-property
```

## Use
**Module**
```typescript
import {
  default as defineProperty
} from '@ganuz/define-property';
```

**Browser**
```html
<script src="https://unpkg.com/@ganuz/define-property/bundle.umd.min.js"></script>
```
```typescript
let {
  defineProperty
} = G;
```

**Examples**
```typescript
 defineProperty(null, 'foo', {value: 'bar'}); // throw TypeError
 defineProperty({}, 'foo', {value: 'bar', get: () => 'bar'}); // throw TypeError
 defineProperty({}, 'foo', {value: 'bar'}); // => true
 defineProperty(Object.freeze({}), 'foo', {value: 'bar'}); // => false
 defineProperty(Object.freeze({car: true}), 'foo', {car: true, enumerable: true}); // => true
 defineProperty(Object.create(null, {drink: {value: 'tea', writable: true}}), 'drink', {value: 'beer'}); // => true
 defineProperty(Object.create({}, {name: {value: 'bob', writable: true}}), 'name', {value: 'alice', configurable: false}); // => true
 defineProperty(Object.create(null, {color: {value: 'red'}}), 'color', {value: 'blue'}); // => false
 defineProperty(Object.create({}, {foo: {value: 'bar'}}), 'foo', {configurable: false}); // => true
```
```typescript
 let object = {color: 'red', get foo (){ return 'bar'; }};

 defineProperty(object, 'name', {value: 'bob'}); // => true
 defineProperty(object, 'color', {value: 'yellow', writable: false}); // => true
 defineProperty(object, 'foo', {value: 'bar', configurable: false}); // => true

 Object.getOwnPropertyDescriptors(object);
 // => {
 //     color: {value: 'yellow', configurable: true, enumerable: true, writable: false},
 //     foo: {value: 'bar', configurable: false, enumerable: true, writable: false},
 //     name: {value: 'bob', configurable: false, enumerable: false, writable: false}
 // }
```

### @ganuz/define-property/polyfill
**Module**
```typescript
  import '@ganuz/define-property/polyfill';
```

**Browser**
```html
<script src="https://unpkg.com/@ganuz/define-property/polyfill/bundle.umd.min.js"></script>
```

## License
Copyright © [Yisrael Eliev](https://github.com/yisraelx),
Licensed under the [MIT license](https://github.com/yisraelx/ganuz/blob/master/LICENSE).

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