All Projects → jonschlinkert → define-property

jonschlinkert / define-property

Licence: MIT License
Define a non-enumerable property on an object.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to define-property

glob-object
Filter an object using glob patterns and dot notation.
Stars: ✭ 25 (+19.05%)
Mutual labels:  object, property
has-value
Returns true if a value exists, false if empty. Works with deeply nested values using object paths.
Stars: ✭ 27 (+28.57%)
Mutual labels:  object, property
object.omit
Return a copy of an object without the given keys.
Stars: ✭ 79 (+276.19%)
Mutual labels:  object, property
CarND-VehicleDetection
vehicle detection with deep learning
Stars: ✭ 34 (+61.9%)
Mutual labels:  object
strongtyping
Decorator which checks whether the function is called with the correct type of parameters.
Stars: ✭ 85 (+304.76%)
Mutual labels:  property
expand-hash
Recursively expands property keys with dot-notation into objects.
Stars: ✭ 25 (+19.05%)
Mutual labels:  object
pykorm
A python 🐍 kubernetes ☸️ ORM 🚀. Very useful when writing operators for your CRDs with Kopf.
Stars: ✭ 56 (+166.67%)
Mutual labels:  object
Object.getOwnPropertyDescriptors
Spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.
Stars: ✭ 19 (-9.52%)
Mutual labels:  object
object-keys
Object.keys shim
Stars: ✭ 41 (+95.24%)
Mutual labels:  object
object-book
Study Object book Content Repository / 조영호 님의 오브젝트 책을 학습하고 정리한 Repo입니다.
Stars: ✭ 30 (+42.86%)
Mutual labels:  object
Stringfication
🔨 Make all objects to String!
Stars: ✭ 33 (+57.14%)
Mutual labels:  object
harmony-ecs
A small archetypal ECS focused on compatibility and performance
Stars: ✭ 33 (+57.14%)
Mutual labels:  object
jackson-dynamic-filter
An easy way to determine filters dynamically using Jackson
Stars: ✭ 35 (+66.67%)
Mutual labels:  property
javascript-easy-object
Now easily access or modify an object in javascript with javascript-easy-object.
Stars: ✭ 13 (-38.1%)
Mutual labels:  object
rename-keys
Modify/rename the keys of the own enumerable properties of an object.
Stars: ✭ 28 (+33.33%)
Mutual labels:  object
copy-anything
An optimised way to copy'ing (cloning) an Object or Array. A small and simple integration
Stars: ✭ 19 (-9.52%)
Mutual labels:  object
property-seeker
Calculate the price range for property advertised on Domain and Real Estate.
Stars: ✭ 30 (+42.86%)
Mutual labels:  property
object.pick
(object pick) returns a filtered copy of an object with only the specified keys, exactly like `pick` from lo-dash / underscore.
Stars: ✭ 39 (+85.71%)
Mutual labels:  object
is-string
Is this value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
Stars: ✭ 17 (-19.05%)
Mutual labels:  object
ECS-CommunityEdition
ECS Community Edition "Free & Frictionless"
Stars: ✭ 125 (+495.24%)
Mutual labels:  object

define-property NPM version NPM monthly downloads NPM total downloads Linux Build Status

Define a non-enumerable property on an object. Uses Reflect.defineProperty when available, otherwise Object.defineProperty.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.

Install

Install with npm:

$ npm install --save define-property

Release history

See the CHANGELOG for updates.

Usage

Params

  • object: The object on which to define the property.
  • key: The name of the property to be defined or modified.
  • value: The value or descriptor of the property being defined or modified.
var define = require('define-property');
var obj = {};
define(obj, 'foo', function(val) {
  return val.toUpperCase();
});

// by default, defined properties are non-enumberable
console.log(obj);
//=> {}

console.log(obj.foo('bar'));
//=> 'BAR'

defining setters/getters

Pass the same properties you would if using Object.defineProperty or Reflect.defineProperty.

define(obj, 'foo', {
  set: function() {},
  get: function() {}
});

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Running 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:

$ npm install && npm test
Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

  • assign-deep: Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… more | homepage
  • extend-shallow: Extend an object with the properties of additional objects. node.js/javascript util. | homepage
  • merge-deep: Recursively merge values in a javascript object. | homepage
  • mixin-deep: Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | homepage

Contributors

Commits Contributor
28 jonschlinkert
1 doowb

Author

Jon Schlinkert

License

Copyright © 2018, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on January 25, 2018.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].