core-decorators
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -26,2 +26,6 @@ 'use strict'; | ||
var _autobind = require('./autobind'); | ||
exports.autobind = _interopRequire(_autobind); | ||
var _readonly = require('./readonly'); | ||
@@ -31,4 +35,8 @@ | ||
var _autobind = require('./autobind'); | ||
var _nonenumerable = require('./nonenumerable'); | ||
exports.autobind = _interopRequire(_autobind); | ||
exports.nonenumerable = _interopRequire(_nonenumerable); | ||
var _nonconfigurable = require('./nonconfigurable'); | ||
exports.nonconfigurable = _interopRequire(_nonconfigurable); |
{ | ||
"name": "core-decorators", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Library of ES7 decorators inspired by languages that come with built-ins like @override, @deprecated, etc", | ||
@@ -5,0 +5,0 @@ "main": "lib/core-decorators.js", |
@@ -23,2 +23,4 @@ # core-decorators.js [![Build Status](https://travis-ci.org/jayphelps/core-decorators.js.svg?branch=master)](https://travis-ci.org/jayphelps/core-decorators.js) | ||
* [@memoize](#memoize) | ||
* [@nonenumerable](#nonenumerable) | ||
* [@nonconfigurable](#nonconfigurable) | ||
@@ -31,3 +33,2 @@ ##### Proposed (not implemented, PRs welcome!): | ||
* @private | ||
* @nonenumerable | ||
@@ -163,4 +164,50 @@ ## Docs | ||
### @nonenumerable | ||
Marks a property or method as not being enumerable. | ||
```js | ||
import { nonenumerable } from 'core-decorators'; | ||
class Meal { | ||
entree = 'steak'; | ||
@nonenumerable | ||
cost = 20.99; | ||
} | ||
var dinner = new Meal(); | ||
for (var key in dinner) { | ||
key; | ||
// "entree" only, not "cost" | ||
} | ||
Object.keys(dinner); | ||
// ["entree"] | ||
``` | ||
### @nonconfigurable | ||
Marks a property or method as not being writable. | ||
```js | ||
import { nonconfigurable } from 'core-decorators'; | ||
class Meal { | ||
@nonconfigurable | ||
entree = 'steak'; | ||
} | ||
var dinner = new Meal(); | ||
Object.defineProperty(dinner, 'entree', { | ||
enumerable: false | ||
}); | ||
// Cannot redefine property: entree | ||
``` | ||
### @memoize | ||
Initial implementation included, likely slow. WIP. |
@@ -5,3 +5,5 @@ export { default as override } from './override'; | ||
export { default as memoize } from './memoize'; | ||
export { default as autobind } from './autobind'; | ||
export { default as readonly } from './readonly'; | ||
export { default as autobind } from './autobind'; | ||
export { default as nonenumerable } from './nonenumerable'; | ||
export { default as nonconfigurable } from './nonconfigurable'; |
@@ -206,7 +206,7 @@ import { decorate } from './private/utils'; | ||
const suggestionTransforms = [ | ||
(key) => key.toLowerCase(), | ||
(key) => key.toUpperCase(), | ||
(key) => key + 's', | ||
(key) => key.slice(0, -1), | ||
(key) => key.slice(1, key.length), | ||
key => key.toLowerCase(), | ||
key => key.toUpperCase(), | ||
key => key + 's', | ||
key => key.slice(0, -1), | ||
key => key.slice(1, key.length), | ||
]; | ||
@@ -213,0 +213,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45610
26
1033
211