Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

core-decorators

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

core-decorators - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

lib/nonconfigurable.js

12

lib/core-decorators.js

@@ -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);

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc