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

def

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

def - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json

@@ -5,3 +5,3 @@ {

"description": "A JavaScript library for creating complex objects and properties, intuitively.",
"version": "0.0.2",
"version": "0.0.3",
"homepage": "https://github.com/Benvie/def",

@@ -8,0 +8,0 @@ "repository": {

@@ -0,4 +1,16 @@

# define def
A single function to make defining sets of properties simple.
## Basic Usage
First it needs to be attached to an object, preferably on a prototype which future objects will inherit from.
var def = require('def');
def(myObject.prototype);
// or expose it to all objects
def(Object.prototype);
Then it should be used directly on the target object which should have the properties, whether that object will be used as a prototype or a singleton.
### named function only

@@ -50,2 +62,3 @@

### dict

@@ -77,2 +90,3 @@

## Private variables

@@ -82,5 +96,19 @@

### simple private usage
myObj.def({
myPrivate: {
get: function(privateValue){
return privateValue;
},
set: function(privateValue, newValue){
return newValue; // privateValue is set to whatever `set` returns
}
}
})
### advanced private usage
myObj.def({
myPrivate: {
get: function(privateValue){
return privateValue.somePublicProperty;

@@ -90,3 +118,3 @@ },

if (newValue.secreyKey === privateValue.unlockKey)
return newValue;
return newValue.newPublicProperty;
} else {

@@ -93,0 +121,0 @@ return privateValue.somePublicProperty;

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