New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nonenumerable

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nonenumerable - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

lib/index.d.ts

@@ -1,1 +0,1 @@

export declare function nonenumerable(target: any, key: string): void;
export declare function nonenumerable(proto: any, key: string): void;
"use strict";
function nonenumerable(target, key) {
var value = target[key];
function nonenumerable(proto, key) {
var priv = "$" + key;
var getter = function () {
return value;
return this[priv];
};
var setter = function (newVal) {
value = newVal;
if (!this.hasOwnProperty(priv)) {
Object.defineProperty(this, priv, {
value: newVal,
enumerable: false,
writable: true
});
}
this[priv] = newVal;
};
if (delete target[key]) {
Object.defineProperty(target, key, {
if (delete proto[key]) {
Object.defineProperty(proto, key, {
get: getter,

@@ -13,0 +20,0 @@ set: setter,

{
"name": "nonenumerable",
"version": "1.0.0",
"version": "1.0.1",
"description": "Decorator to make properties non-enumerable.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -1,14 +0,21 @@

export function nonenumerable(target: any, key: string) {
var value = target[ key ];
export function nonenumerable(proto: any, key: string) {
const priv = `$${key}`;
var getter = function () {
return value;
return this[priv];
};
var setter = function (newVal: any) {
value = newVal;
if (!this.hasOwnProperty(priv)) {
Object.defineProperty(this, priv, {
value: newVal,
enumerable: false,
writable: true
});
}
this[priv] = newVal;
};
if (delete target[key]) {
Object.defineProperty(target, key, {
if (delete proto[ key ]) {
Object.defineProperty(proto, key, {
get: getter,

@@ -15,0 +22,0 @@ set: setter,

@@ -9,3 +9,3 @@ import { assert } from "chai";

@nonenumerable
private c = 3;
c = 3;

@@ -31,2 +31,8 @@ constructor () {

it("should support multiple instances", () => {
let secondInstance = new NonEnumerable();
secondInstance.c = 10;
assert.notEqual(secondInstance.c, nonEnumerable.c);
});
});
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