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

cocktail

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cocktail - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

lib/processor/annotation/Static.js

3

lib/Cocktail.js

@@ -255,3 +255,4 @@ /*

'@annotation' : require('./processor/annotation/Annotation'),
'@exports' : require('./processor/annotation/Exports')
'@exports' : require('./processor/annotation/Exports'),
'@static' : require('./processor/annotation/Static'),
};

@@ -258,0 +259,0 @@

@@ -40,2 +40,1 @@ /*

module.exports = Annotation;

@@ -17,11 +17,11 @@ /*

_value: undefined,
_parameter: undefined,
setParameter: function(value) {
this._value = value;
this._parameter = value;
},
getParameter: function() {
return this._value;
return this._parameter;
},

@@ -28,0 +28,0 @@

@@ -17,3 +17,3 @@ /*

_value: undefined,
_parameter: undefined,

@@ -24,7 +24,7 @@ setParameter: function(value){

}
this._value = value;
this._parameter = value;
},
getParameter: function() {
return this._value;
return this._parameter;
},

@@ -31,0 +31,0 @@

@@ -9,4 +9,16 @@ /*

var sequence = require('../sequence'),
Merge = function(){};
Merge;
/**
* @constructor
*/
Merge = function(options) {
var useProto;
if(options) {
useProto = options.usePrototypeWhenSubjectIsClass;
this._usePrototypeWhenSubjectIsClass = (useProto === false) ? useProto : true;
}
};
Merge.prototype = {

@@ -17,4 +29,6 @@ retain : false,

_value : undefined,
_parameter : undefined,
_usePrototypeWhenSubjectIsClass: true,
_strategies: {

@@ -29,7 +43,7 @@ 'single' : '_mergeMine',

setParameter: function(value){
this._value = value;
this._parameter = value;
},
getParameter: function() {
return this._value;
return this._parameter;
},

@@ -120,11 +134,16 @@

_shouldUsePrototypeWhenSubjectIsClass: function() {
return this._usePrototypeWhenSubjectIsClass;
},
process: function(subject, proto){
var their = proto,
mine = subject.prototype || subject,
useProto = this._shouldUsePrototypeWhenSubjectIsClass(),
mine = (useProto && subject.prototype) || subject,
strategy = this._strategies[this.getParameter()];
this[strategy](mine, their);
this[strategy](mine, their);
}
};
module.exports = Merge;
module.exports = Merge;

@@ -17,3 +17,3 @@ /*

_value: undefined,
_parameter: undefined,

@@ -24,7 +24,7 @@ setParameter: function(value){

}
this._value = value;
this._parameter = value;
},
getParameter: function() {
return this._value;
return this._parameter;
},

@@ -70,2 +70,2 @@

module.exports = Properties;
module.exports = Properties;

@@ -19,11 +19,11 @@ /*

_value: [],
_parameter: [],
setParameter: function(value){
//TODO: validate parameter
this._value = [].concat(value);
this._parameter = [].concat(value);
},
getParameter: function() {
return this._value;
return this._parameter;
},

@@ -52,2 +52,2 @@

module.exports = Requires;
module.exports = Requires;

@@ -18,11 +18,11 @@ /*

_value: [],
_parameter: [],
setParameter: function(value){
//TODO: validate parameter
this._value = [].concat(value);
this._parameter = [].concat(value);
},
getParameter: function() {
return this._value;
return this._parameter;
},

@@ -29,0 +29,0 @@

{
"name": "cocktail",
"description": "CocktailJS is a small library to explore traits, talents, inheritance and annotations concepts in nodejs - Shake your objects and classes with Cocktail!",
"version": "0.3.0",
"version": "0.4.0",
"homepage": "http://cocktailjs.github.io",

@@ -6,0 +6,0 @@ "author": {

@@ -111,4 +111,9 @@ # Cocktail JS

- 0.4.0
- status: Alpha
- Added `@static` annotation to define static members on class mix.
- Tests for `@static` annotation.
- Refactored Merge processor. Added constructor parameter to reuse functionality on Static processor.
- 0.3.0 (current master)
- 0.3.0
- status: Alpha

@@ -115,0 +120,0 @@ - Introduced pseudo-annotation `@as` intended for single parameter class definition

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