source: trip-planner-front/node_modules/define-property/README.md@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.7 KB
Line 
1# define-property [![NPM version](https://img.shields.io/npm/v/define-property.svg?style=flat)](https://www.npmjs.com/package/define-property) [![NPM monthly downloads](https://img.shields.io/npm/dm/define-property.svg?style=flat)](https://npmjs.org/package/define-property) [![NPM total downloads](https://img.shields.io/npm/dt/define-property.svg?style=flat)](https://npmjs.org/package/define-property) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/define-property.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/define-property)
2
3> Define a non-enumerable property on an object. Uses Reflect.defineProperty when available, otherwise Object.defineProperty.
4
5Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6
7## Install
8
9Install with [npm](https://www.npmjs.com/):
10
11```sh
12$ npm install --save define-property
13```
14
15## Release history
16
17See [the CHANGELOG](changelog.md) for updates.
18
19## Usage
20
21**Params**
22
23* `object`: The object on which to define the property.
24* `key`: The name of the property to be defined or modified.
25* `value`: The value or descriptor of the property being defined or modified.
26
27```js
28var define = require('define-property');
29var obj = {};
30define(obj, 'foo', function(val) {
31 return val.toUpperCase();
32});
33
34// by default, defined properties are non-enumberable
35console.log(obj);
36//=> {}
37
38console.log(obj.foo('bar'));
39//=> 'BAR'
40```
41
42**defining setters/getters**
43
44Pass the same properties you would if using [Object.defineProperty](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) or [Reflect.defineProperty](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/defineProperty).
45
46```js
47define(obj, 'foo', {
48 set: function() {},
49 get: function() {}
50});
51```
52
53## About
54
55<details>
56<summary><strong>Contributing</strong></summary>
57
58Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
59
60</details>
61
62<details>
63<summary><strong>Running Tests</strong></summary>
64
65Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
66
67```sh
68$ npm install && npm test
69```
70
71</details>
72
73<details>
74<summary><strong>Building docs</strong></summary>
75
76_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
77
78To generate the readme, run the following command:
79
80```sh
81$ npm install -g verbose/verb#dev verb-generate-readme && verb
82```
83
84</details>
85
86### Related projects
87
88You might also be interested in these projects:
89
90* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target (first) object.")
91* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.")
92* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.")
93* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.")
94
95### Contributors
96
97| **Commits** | **Contributor** |
98| --- | --- |
99| 28 | [jonschlinkert](https://github.com/jonschlinkert) |
100| 1 | [doowb](https://github.com/doowb) |
101
102### Author
103
104**Jon Schlinkert**
105
106* Connect with me on [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)
107* Follow me on [github/jonschlinkert](https://github.com/jonschlinkert)
108* Follow me on [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
109
110### License
111
112Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
113Released under the [MIT License](LICENSE).
114
115***
116
117_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on January 25, 2018._
Note: See TracBrowser for help on using the repository browser.