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

brink

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brink - npm Package Compare versions

Comparing version 0.2.0 to 0.2.2

.jshintignore

11

package.json
{
"name": "brink",
"version": "0.2.0",
"version": "0.2.2",
"description": "",

@@ -10,3 +10,4 @@ "main": "./src/brink/brink.js",

"scripts": {
"test": "node ./tests/run-tests.js"
"test": "node ./tests/run-tests.js",
"build": "node ./tasks/build.js"
},

@@ -25,6 +26,8 @@ "repository": {

"devDependencies": {
"blanket": "git+ssh://git@github.com:alex-seville/blanket.git",
"browserify": "~3.30.1",
"chai": "~1.8.1",
"chai": "~2.2.0",
"chalk": "^1.0.0",
"component-ajax": "0.0.2",
"html-file-cov": "^1.0.0",
"includer": "0.0.2",

@@ -37,3 +40,3 @@ "jquery": "^2.1.1",

"minimatch": "~0.2.14",
"mocha": "~1.16.2",
"mocha": "~2.2.1",
"require-main": "^0.1.1",

@@ -40,0 +43,0 @@ "string-length": "^1.0.0",

@@ -65,5 +65,8 @@ 'use strict';

include('./polyfills/Array.isArray.js');
include('./polyfills/Document.registerElement.js');
include('./polyfills/Function.bind.js');
include('./polyfills/requestAnimationFrame.js');
$b.F = EMPTY_FN;
/*

@@ -75,3 +78,3 @@ These are empty functions for production builds,

$b.assert = $b.error = $b.required = EMPTY_FN;
$b.assert = $b.error = EMPTY_FN;

@@ -111,3 +114,3 @@ /********* RESOLVER *********/

'brink/dev/error',
'brink/dev/required',
'brink/dev/warn',

@@ -121,10 +124,13 @@ 'brink/utils/alias',

'brink/utils/extend',
'brink/utils/expandProps',
'brink/utils/extend',
'brink/utils/flatten',
'brink/utils/inject',
'brink/utils/intersect',
'brink/utils/params',
'brink/utils/promise',
'brink/utils/xhr',
'brink/utils/ready',
'brink/utils/isBrinkInstance',
'brink/utils/isBrinkObject',
'brink/utils/isFunction',

@@ -136,2 +142,5 @@ 'brink/utils/isObject',

'brink/utils/trim',
'brink/utils/unbound',
'brink/utils/registerModel',
'brink/utils/unregisterModel',

@@ -149,2 +158,3 @@ 'brink/core/Object',

'brink/dom/Template',
'brink/dom/Component',
'brink/dom/Tag',

@@ -156,6 +166,13 @@ 'brink/dom/Text',

'brink/browser/ajax',
'brink/browser/ready',
'brink/browser/ReactMixin',
'brink/data/Adapter',
'brink/data/RESTAdapter',
'brink/data/attr',
'brink/data/belongsTo',
'brink/data/hasMany',
'brink/data/Model',
'brink/data/Store',
'brink/data/Collection',
'brink/amd/text',
'brink/node/build'

@@ -167,10 +184,6 @@ ]

/* jscs : enable */
/* jscs : enable */
/********* ALIASES *********/
$b.merge($b, {
F : EMPTY_FN
});
$b.merge($b.config, CONFIG);

@@ -184,3 +197,12 @@

else {
$b.require(deps, cb);
deps = deps || [];
if (deps.length) {
$b.require(deps, cb);
}
else {
if (cb) {
cb();
}
}
}

@@ -203,3 +225,3 @@

$b.configure({paths : {brink : __dirname}});
$b.configure({paths : {brink : __dirname, plugins : __dirname + '/amd'}});
$b.init();

@@ -206,0 +228,0 @@ $b.configure({paths : null});

@@ -7,32 +7,5 @@ $b.define(

var IS_IE,
IE_VERSION,
DIRTY_CHECK;
IE_VERSION = (function (rv, ua, re) {
if (typeof navigator !== 'undefined' && navigator && navigator.appName === 'Microsoft Internet Explorer') {
ua = navigator.userAgent;
re = new RegExp('MSIE ([0-9]{1,}[\.0-9]{0,})');
if (re.exec(ua) != null) {
rv = parseFloat(RegExp.$1);
}
}
return rv || -1;
})();
IS_IE = IE_VERSION > -1;
DIRTY_CHECK = (IS_IE && IE_VERSION < 9) || (!Object.defineProperty && !Object.__defineGetter__);
return ({
DIRTY_CHECK : DIRTY_CHECK,
IS_IE : IS_IE,
IE_VERSION : IE_VERSION
});
return {};
}
).attach('$b');
$b(
[
'./Object'
'./Object',
'../utils/get',
'../utils/computed'
],
function (Obj) {
function (Obj, get, computed) {

@@ -18,4 +20,7 @@ 'use strict';

length : computed(function () {
return this.content.length;
}, 'content'),
content : null,
length : 0,

@@ -41,2 +46,3 @@ oldContent : null,

this.contentDidChange = this.contentDidChange.bind(this);
this.watch('content', this.contentDidChange);

@@ -64,11 +70,15 @@ },

findBy : function (q, v) {
find : function (fn, scope) {
var i,
item;
l,
r,
t;
for (i = 0; i < this.content.length; i ++) {
item = this.content[i];
if (item[q] === v) {
return item;
r = [];
for (i = 0, l = this.content.length; i < l; i ++) {
t = this.content[i];
if (fn.call(scope, t, i, this)) {
return t;
}

@@ -80,22 +90,30 @@ }

findIndexBy : function (q, v) {
findBy : function (key, val) {
var i,
item;
return this.find(function (item) {
return get(item, key) === val;
});
},
for (i = 0; i < this.content.length; i ++) {
item = this.content[i];
if (item[q] === v) {
return i;
}
}
filter : function () {
return -1;
var filtered = [];
filtered = AP.filter.apply(this.content, arguments);
return Arr.create(filtered);
},
filterBy : function (key, val) {
return this.filter(function (item) {
return get(item, key) === val;
});
},
forEach : function (fn, scope) {
var i;
var i,
l;
for (i = 0; i < this.content.length; i ++) {
for (i = 0, l = this.content.length; i < l; i ++) {
fn.call(scope, this.content[i], i, this);

@@ -107,10 +125,5 @@ }

concat : function () {
var r = AP.concat.apply(this.content, arguments);
return this.prototype.constructor.create(r);
return Arr.create(this.content.concat());
},
insert : function () {
return this.push.apply(this, arguments);
},
insertAt : function (i, o) {

@@ -121,2 +134,6 @@ this.splice(i, 0, o);

indexOf : function (o) {
return this.content.indexOf(o);
},
push : function () {

@@ -127,10 +144,10 @@

for (i = 0; i < arguments.length; i ++) {
this.insertAt(this.length, arguments[i]);
this.insertAt(get(this, 'length'), arguments[i]);
}
return this.length;
return get(this, 'length');
},
pop : function (i) {
i = this.length - 1;
i = get(this, 'length') - 1;
return this.removeAt(i);

@@ -204,8 +221,8 @@ },

unshift : function () {
var i;
for (i = 0; i < arguments.length; i ++) {
this.insertAt(0, this.arguments[i]);
var i = arguments.length;
while (i--) {
this.insertAt(0, arguments[i]);
}
return this.length;
return get(this, 'length');
},

@@ -216,3 +233,3 @@

if (!this.pristineContent) {
this.pristineContent = this.content;
this.pristineContent = this.content.concat();
}

@@ -225,18 +242,6 @@

filter : function () {
if (!this.pristineContent) {
this.pristineContent = this.content;
}
this.content = AP.filter.apply(this.content, arguments);
this.contentDidChange();
return this.content;
},
sort : function () {
if (!this.pristineContent) {
this.pristineContent = this.content;
this.content = this.content.concat();
this.pristineContent = this.content.concat();
}

@@ -246,3 +251,3 @@

this.contentDidChange();
return this.content;
return this;
},

@@ -351,3 +356,3 @@

contentDidChange : function () {
this.set('length', this.content.length);
this.propertyDidChange('length');
this.propertyDidChange('@each');

@@ -354,0 +359,0 @@ }

$b(
[
'../utils/merge',
'../utils/extend'
],
function (extend) {
function (merge, extend) {

@@ -66,2 +67,4 @@ 'use strict';

BrinkObject.__meta = merge({isObject : true}, BrinkObject.__meta);
return BrinkObject;

@@ -105,2 +108,6 @@ };

CoreObject.toString = function () {
return this.__meta.name;
};
return CoreObject;

@@ -107,0 +114,0 @@ }

@@ -184,3 +184,3 @@ $b(

}
}
}

@@ -187,0 +187,0 @@ meta.watchedProps = flatten(meta.watchers.props);

@@ -147,4 +147,2 @@ $b(

looped.push(instance);
meta = instance.__meta;

@@ -166,3 +164,3 @@ references = meta.references;

if (~looped.indexOf(reference)) {
if (looped.indexOf(reference) > -1) {
continue;

@@ -175,7 +173,7 @@ }

/* TODO : Move this....
/* TODO : Move this.... */
if (reference.isDestroyed) {
instance.__removeReference(reference);
continue;
}*/
}
watched = this.processBindings(reference, changed.concat(), meta2, key);

@@ -182,0 +180,0 @@ manager.propertiesDidChange(reference, watched);

@@ -160,3 +160,3 @@ $b(

$b.define('notificationManager', NotificationManager).attach('$b');
$b.define('notificationManager', NotificationManager).attach('$b');

@@ -163,0 +163,0 @@ return NotificationManager;

@@ -140,2 +140,4 @@ $b(

meta.memoizedBindings = {};
return meta;

@@ -186,3 +188,3 @@ },

// Modern browsers, IE9 +
// Modern browsers, IE9 +
if (Object.defineProperty) {

@@ -380,3 +382,2 @@ Object.defineProperty(this, p, d);

meta.externalBindings = meta.externalBindings || {};
meta.memoizedBindings = meta.memoizedBindings || {};

@@ -394,6 +395,11 @@ if (typeof meta.properties[key] !== 'undefined') {

set : true,
value : val
value : val,
watch : null
};
}
else {
val.__meta.key = key;
}
val = meta.properties[key] = defineProperty(obj, key, val);

@@ -406,3 +412,5 @@ val.key = key;

tmp = [];
while (i--) {
a = watched[i].split('.');

@@ -628,2 +636,6 @@ p = null;

toString : function () {
return '[instance ' + this.constructor.__meta.name + ']';
},
/***********************************************************************

@@ -734,2 +746,3 @@ Destroys an object, removes all bindings and watchers and clears all metadata.

proto.__parsePrototype.call(proto);
proto.constructor = SubObj;

@@ -739,41 +752,2 @@ return SubObj;

Obj.define = function () {
$b.define(this.prototype.__dependencies, bindFunction(this.resolveDependencies, this));
return this;
};
Obj.resolveDependencies = function () {
var proto,
p;
proto = this.prototype;
for (p in proto.__dependencies) {
proto[p] = proto.__dependencies[p].resolve();
}
this.__meta.dependenciesResolved = true;
return this;
};
Obj.load = function (cb) {
cb = typeof cb === 'function' ? cb : function () {};
if (this.__meta.dependenciesResolved) {
cb(this);
}
$b.require(this.prototype.__dependencies, bindFunction(function () {
this.resolveDependencies.call(this);
cb(this);
}, this));
return this;
};
Obj.__meta = merge(Obj.__meta || {}, {isObject: true});
return Obj;

@@ -780,0 +754,0 @@ }

@@ -14,3 +14,2 @@ $b(

isAttr : true,
isDynamic : true,
updateProp : 'value'

@@ -17,0 +16,0 @@

@@ -22,3 +22,7 @@ $b(

isElement : false,
isDynamic : false,
isDynamic : $b.computed(function () {
return !!this.get('tokens').length;
}, 'tokens'),
isLocked : false,

@@ -28,5 +32,6 @@

parent : null,
context : $b.bindTo('parent.context'),
context : null,
templateString : '',
processedTemplateString : '',
processedTemplate : '',
cachedValue : null,

@@ -71,3 +76,3 @@

this.set('tokens', tokens);
this.set('processedTemplateString', trim(str) || '');
this.set('processedTemplate', trim(str) || '');
},

@@ -88,6 +93,4 @@

contextWatcher : function () {
var props;
props = this.get('watchedProperties');
this.unwatch(this.contextUpdated);

@@ -115,3 +118,3 @@

var val = this.replaceTokens(
this.get('processedTemplateString'),
this.get('processedTemplate'),
this.get('tokens')

@@ -126,8 +129,10 @@ );

render : function () {
this.updateDOM();
render : function (context) {
if (this.get('isDynamic')) {
this.set('context', context);
}
},
rerender : function () {
this.render();
this.updateDOM();
},

@@ -134,0 +139,0 @@

@@ -8,6 +8,7 @@ $b(

'../utils/get',
'../utils/trim'
'../utils/trim',
'../utils/unbound'
],
function (BrinkAttr, BrinkText, DOMObject, get, trim) {
function (BrinkAttr, BrinkText, DOMObject, get, trim, unbound) {

@@ -19,3 +20,2 @@ 'use strict';

isElement : true,
isDynamic : false,
tokens : null,

@@ -108,3 +108,3 @@

dom : child,
parent : this
parent : unbound(this)
})

@@ -130,3 +130,3 @@ );

dom : child,
parent : this
parent : unbound(this)
})

@@ -150,3 +150,3 @@ );

dom : attr,
parent : this
parent : unbound(this)
}));

@@ -164,3 +164,3 @@ }

render : function () {
render : function (context) {

@@ -174,7 +174,7 @@ var children,

children.forEach(function (child) {
child.rerender();
child.render(context);
});
attributes.forEach(function (attr) {
attr.rerender();
attr.render(context);
});

@@ -184,3 +184,15 @@ },

rerender : function () {
this.render();
var children,
attributes;
children = this.get('children') || [];
attributes = this.get('attributes') || [];
children.forEach(function (child) {
child.rerender();
});
attributes.forEach(function (attr) {
attr.rerender();
});
},

@@ -187,0 +199,0 @@

@@ -36,2 +36,12 @@ $b(

},
render : function (context) {
this.set('context', context);
this._super(context);
this.updateDOM();
},
rerender : function () {
this.updateDOM();
}

@@ -38,0 +48,0 @@ });

@@ -119,3 +119,2 @@ $b(

tmpl = this.get('template');
lKey = this.get('loopKey');

@@ -179,8 +178,3 @@

}
},
render : function () {
this.updateDOM();
}
});

@@ -187,0 +181,0 @@ }

@@ -101,2 +101,3 @@ $b(

var dom,
context,
fragment,

@@ -108,2 +109,4 @@ domParent;

context = this.get('context');
if (domParent && children && children.length) {

@@ -114,7 +117,11 @@

children.forEach(function (child) {
fragment.appendChild(child.get('dom'));
child.set('context', context);
if (child.get('isTag')) {
child.set('isLocked', false);
child.contextUpdated();
}
fragment.appendChild(child.get('dom'));
});

@@ -140,2 +147,6 @@

if (this.parentHasChild(domParent, dom)) {
domParent.removeChild(dom);
}
if (child.get('isTag')) {

@@ -145,5 +156,3 @@ child.set('isLocked', true);

if (this.parentHasChild(domParent, dom)) {
domParent.removeChild(dom);
}
child.set('context', null);

@@ -175,6 +184,2 @@ }.bind(this));

}
},
render : function () {
this.updateDOM();
}

@@ -181,0 +186,0 @@ });

@@ -7,6 +7,7 @@ $b(

'../utils/get',
'../browser/ready'
'../utils/ready',
'../utils/unbound'
],
function (BrinkElement, Class, get, ready) {
function (BrinkElement, Class, get, ready, unbound) {

@@ -57,2 +58,3 @@ 'use strict';

dom : $b.bindTo('domObj.dom'),
dom2 : $b.bindTo('domObj.dom'),

@@ -63,5 +65,3 @@ init : function (tmpl, isClone) {

$b.assert('Must pass a string or Node when constructing a Template', !!tmpl);
this.template = tmpl;
this.compile();
this.compile(tmpl);
}

@@ -81,14 +81,16 @@ },

compile : function () {
compile : function (tmpl) {
var tmpl,
var el,
children,
fragment;
tmpl = this.template;
if (!(tmpl instanceof Node)) {
tmpl = this.parseHTML(replaceTags(tmpl));
if ((tmpl instanceof Node)) {
el = document.createElement('div');
el.appendChild(tmpl);
tmpl = el.innerHTML;
}
this.template = tmpl = this.parseHTML(replaceTags(tmpl));
children = tmpl.childNodes;

@@ -104,3 +106,3 @@

dom : fragment,
parent : this
parent : unbound(this)
}));

@@ -117,3 +119,3 @@

dom : this.get('dom').cloneNode(true),
parent : tmpl
parent : unbound(tmpl)
}));

@@ -129,5 +131,6 @@

render : function (context) {
this.set('context', context);
this.get('domObj').render(true);
return this.get('dom');
var clone = this.clone();
clone.set('context', context);
clone.get('domObj').render(context);
return clone.get('dom');
},

@@ -151,18 +154,2 @@

var style;
style = document.createElement('style');
style.appendChild(document.createTextNode(''));
document.head.appendChild(style);
style.sheet.insertRule('brink-template {display : none;}', 0);
if (document.registerElement) {
document.registerElement('brink-template');
}
// IE...
else {
document.createElement('brink-template');
}
// Load any templates in the DOM...

@@ -176,10 +163,45 @@ ready(function () {

templates = document.getElementsByTagName('brink-template');
function polyfill () {
var i,
el,
frag,
style,
content,
templates;
style = document.createElement('style');
style.appendChild(document.createTextNode(''));
document.head.appendChild(style);
style.sheet.insertRule('template {display : none;}', 0);
templates = document.getElementsByTagName('template');
i = templates.length;
while (i --) {
el = templates[i];
content = el.childNodes;
frag = document.createDocumentFragment();
while (content[0]) {
frag.appendChild(content[0]);
}
el.content = frag;
}
}
templates = document.getElementsByTagName('template');
if (templates.length && !('content' in templates[0])) {
polyfill();
}
for (i = 0; i < templates.length; i ++) {
tmpl = templates[i];
name = tmpl.getAttribute('name');
$b.assert('Embedded templates must specify a name... ' + tmpl.innerHTML, !!name);
$b('templates/' + name, Template.create(tmpl.innerHTML));
if (name) {
$b('templates/' + name, Template.create(tmpl.content));
}
}

@@ -186,0 +208,0 @@ });

@@ -14,3 +14,2 @@ $b(

isText : true,
isDynamic : true,
updateProp : 'nodeValue'

@@ -17,0 +16,0 @@

;(function () {
'use strict';
'use strict';
if (!Array.prototype.filter) {
if (!Array.prototype.filter) {
Array.prototype.filter = function (fn, scope) {
Array.prototype.filter = function (fn, scope) {
var result = [];
var result = [];
this.forEach(function (val, i) {
if (fn.call(scope, val, i, this)) {
result.push(val);
}
});
this.forEach(function (val, i) {
if (fn.call(scope, val, i, this)) {
result.push(val);
}
});
return result;
return result;
};
}
};
}
})();
;(function () {
'use strict';
'use strict';
if (!Array.prototype.forEach) {
if (!Array.prototype.forEach) {
Array.prototype.forEach = function (fn, scope) {
Array.prototype.forEach = function (fn, scope) {
var i,
l;
var i,
l;
l = this.length || 0;
l = this.length || 0;
for (i = 0; i < l; i ++) {
fn.call(scope, this[i], i, this);
}
};
}
for (i = 0; i < l; i ++) {
fn.call(scope, this[i], i, this);
}
};
}
})();
;(function () {
'use strict';
'use strict';
if (!Array.prototype.indexOf) {
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (a, b) {
Array.prototype.indexOf = function (a, b) {
if (!this.length || !(this instanceof Array) || arguments.length < 1) {
return -1;
}
if (!this.length || !(this instanceof Array) || arguments.length < 1) {
return -1;
}
b = b || 0;
b = b || 0;
if (b >= this.length) {
return -1;
}
if (b >= this.length) {
return -1;
}
while (b < this.length) {
if (this[b] === a) {
return b;
}
b += 1;
}
return -1;
};
}
while (b < this.length) {
if (this[b] === a) {
return b;
}
b += 1;
}
return -1;
};
}
})();
;(function () {
'use strict';
'use strict';
if (!Function.prototype.bind) {
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
Function.prototype.bind = function (oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
FNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof FNOP ? this : oThis || window,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
FNOP = function () {},
fBound = function () {
return fToBind.apply(this instanceof FNOP ? this : oThis || window,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
FNOP.prototype = this.prototype;
fBound.prototype = new FNOP();
return fBound;
};
}
FNOP.prototype = this.prototype;
fBound.prototype = new FNOP();
return fBound;
};
}
})();
;(function () {
'use strict';
'use strict';
var _global = typeof window !== 'undefined' ? window : global;
var _global = typeof window !== 'undefined' ? window : global;
if (typeof _global !== 'undefined' && (!_global.requestAnimationFrame || !_global.cancelAnimationFrame)) {
if (typeof _global !== 'undefined' && (!_global.requestAnimationFrame || !_global.cancelAnimationFrame)) {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for (var x = 0; x < vendors.length && !_global.requestAnimationFrame; x ++) {
_global.requestAnimationFrame = _global[vendors[x] + 'RequestAnimationFrame'];
_global.cancelAnimationFrame = _global[vendors[x] + 'CancelAnimationFrame'] ||
_global[vendors[x] + 'CancelRequestAnimationFrame'];
}
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for (var x = 0; x < vendors.length && !_global.requestAnimationFrame; x ++) {
_global.requestAnimationFrame = _global[vendors[x] + 'RequestAnimationFrame'];
_global.cancelAnimationFrame = _global[vendors[x] + 'CancelAnimationFrame'] ||
_global[vendors[x] + 'CancelRequestAnimationFrame'];
}
if (!_global.requestAnimationFrame) {
_global.requestAnimationFrame = function (callback) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = _global.setTimeout(function () {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
}
if (!_global.requestAnimationFrame) {
_global.requestAnimationFrame = function (callback) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = _global.setTimeout(function () {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};
}
if (!_global.cancelAnimationFrame) {
_global.cancelAnimationFrame = function (id) {
clearTimeout(id);
};
}
if (!_global.cancelAnimationFrame) {
_global.cancelAnimationFrame = function (id) {
clearTimeout(id);
};
}
return _global.requestAnimationFrame;
}
return _global.requestAnimationFrame;
}
})();

@@ -115,5 +115,4 @@ (function () {

if ($b.CoreObject && module.prototype instanceof $b.CoreObject) {
module.toString = function () {
return 'Brink.' + idPart;
};
module.__meta = module.__meta || {};
module.__meta.name = 'Brink.' + idPart;
}

@@ -123,12 +122,7 @@ }

this.attachTo[idPart] = this.module.exports || this.module;
return;
}
if (this.id && module && !module.hasOwnProperty('toString')) {
if ($b.CoreObject && module.prototype instanceof $b.CoreObject) {
module.toString = function () {
return id;
};
}
if (this.id && module && module.__meta) {
module.__meta.name = this.id;
}

@@ -308,2 +302,3 @@ }

*/
pluginPath = (context ? context + '/' : '') + 'plugins/' + module.replace(/\//g, '_');

@@ -347,3 +342,3 @@

}) :
_normalize(module);
_resolve(_normalize(module), context);

@@ -673,4 +668,3 @@ function load (definition) {

if (!callback) {
if (!callback && typeof ids === 'string') {
/**

@@ -706,2 +700,6 @@ * If no callback is specified, then try to get the module by it's ID

if (!callback) {
callback = function () {};
}
ids = (!Array.isArray(ids)) ? [ids] : ids;

@@ -708,0 +706,0 @@ modules = [];

$b(
[
'./alias',
'./computed',

@@ -12,3 +13,3 @@ './getObjKeyPair',

************************************************************************/
function (computed, getObjKeyPair, isBrinkInstance) {
function (alias, computed, getObjKeyPair, isBrinkInstance) {

@@ -66,17 +67,3 @@ 'use strict';

else {
prop = a;
b = computed({
watch : prop,
get : function () {
return this.get(prop);
},
set : function (val) {
return this.set(prop, val);
}
});
b = alias(a);
}

@@ -83,0 +70,0 @@

@@ -94,5 +94,20 @@ $b(

o.watch = o.watch ? [].concat(o.watch) : [];
o.watch = o.hasOwnProperty('watch') ? [].concat(o.watch) : [];
o.__meta = {};
o.__isComputed = true;
o.meta = function (m) {
var p;
if (typeof m !== 'undefined') {
for (p in m) {
o.__meta[p] = m[p];
}
}
return o.__meta;
}.bind(o);
return o;

@@ -99,0 +114,0 @@ };

@@ -67,47 +67,51 @@ $b(

if (skipCompare || isDiff) {
if (!skipCompare && !isDiff) {
return false;
}
if (obj instanceof $b.Object) {
if (obj instanceof $b.Object) {
if (isDiff) {
if (old instanceof $b.Object) {
old.__removeReference(obj);
}
if (val instanceof $b.Object) {
val.__addReference(
obj,
(
key === 'proxy' &&
val instanceof $b.ObjectProxy ?
'' :
key
)
);
}
if (isDiff) {
if (old instanceof $b.Object) {
old.__removeReference(obj);
}
if (obj.__meta.setters[key]) {
obj.__meta.setters[key].call(obj, val, key);
if (val instanceof $b.Object) {
val.__addReference(
obj,
(
key === 'proxy' &&
val instanceof $b.ObjectProxy ?
'' :
key
)
);
}
}
else {
if (val && val.__isUnbound) {
val = val.value;
}
if (obj.__meta.pojoStyle) {
obj[key] = val;
}
if (obj.__meta.setters[key]) {
obj.__meta.setters[key].call(obj, val, key);
}
obj.__meta.values[key] = val;
else {
if (obj.__meta.pojoStyle) {
obj[key] = val;
}
if (!quiet) {
obj.propertyDidChange(key);
}
obj.__meta.values[key] = val;
}
else {
obj[key] = val;
if (!quiet) {
obj.propertyDidChange(key);
}
}
else {
obj[key] = val;
}
return obj;

@@ -114,0 +118,0 @@ }

@@ -1,10 +0,8 @@

describe("$b.Array", function () {
describe('Brink.Array', function () {
before (function () {
});
it('should populate the content property on init', function (done) {
it('should populate the content property on init', function () {

@@ -18,8 +16,34 @@ var a;

expect(a.content[2]).to.equal(3);
});
done();
it('should properly concat', function () {
var a,
b;
a = $b.Array.create([1,2,3]);
b = a.concat();
expect(a.content).to.deep.equal(b.content);
});
require("./mutations");
it('should iterate with forEach', function () {
var a,
b;
a = $b.Array.create([1,2,3]);
b = [];
a.forEach(function (item) {
b.push(item);
});
expect(a.content).to.deep.equal(b);
});
require('./mutations');
require('./sorting');
require('./find_filter');
after (function () {

@@ -26,0 +50,0 @@

@@ -13,5 +13,5 @@ describe('mutations', function () {

a.destroy();
});
it('should allow setting indices with set()', function () {

@@ -22,8 +22,146 @@

a = $b.Array.create([1,2,3]);
expect(a.content).to.deep.equal([1,2,3]);
a.set(2, 10);
expect(a.get(2)).to.equal(10);
expect(a.get(2)).to.equal(10);
a.destroy();
});
it('should allow pushing items with push()', function () {
var a;
a = $b.Array.create([1,2,3]);
expect(a.content).to.deep.equal([1,2,3]);
a.push(4,5,6);
expect(a.content).to.deep.equal([1,2,3,4,5,6]);
a.destroy();
});
it('should allow adding items with insertAt()', function () {
var a;
a = $b.Array.create([1,2,3]);
expect(a.content).to.deep.equal([1,2,3]);
a.insertAt(3, 4);
expect(a.content).to.deep.equal([1,2,3,4]);
a.destroy();
});
it('should allow removing items with remove()', function () {
var a;
a = $b.Array.create([1,2,3,4,5,6]);
expect(a.content).to.deep.equal([1,2,3,4,5,6]);
a.remove(3);
expect(a.content).to.deep.equal([1,2,4,5,6]);
a.destroy();
});
it('should allow removing items with removeAt()', function () {
var a;
a = $b.Array.create([1,2,3,4,5,6]);
expect(a.content).to.deep.equal([1,2,3,4,5,6]);
a.removeAt(0);
expect(a.content).to.deep.equal([2,3,4,5,6]);
a.destroy();
});
it('should allow removing items with pop()', function () {
var a,
b;
a = $b.Array.create([1,2,3,4,5,6]);
expect(a.content).to.deep.equal([1,2,3,4,5,6]);
b = a.pop();
expect(b).to.equal(6);
expect(a.content).to.deep.equal([1,2,3,4,5]);
a.destroy();
});
it('should allow removing items with shift()', function () {
var a,
b;
a = $b.Array.create([1,2,3,4,5,6]);
expect(a.content).to.deep.equal([1,2,3,4,5,6]);
b = a.shift();
expect(b).to.equal(1);
expect(a.content).to.deep.equal([2,3,4,5,6]);
a.destroy();
});
it('should allow adding/removing items with splice()', function () {
var a;
a = $b.Array.create([1,1,1]);
expect(a.content).to.deep.equal([1,1,1]);
a.splice(1, 2, 2, 3, 4);
expect(a.content).to.deep.equal([1,2,3,4]);
a.destroy();
});
it('should allow adding items with unshift()', function () {
var a;
a = $b.Array.create([4,5,6]);
expect(a.content).to.deep.equal([4,5,6]);
a.unshift(1,2,3);
expect(a.content).to.deep.equal([1,2,3,4,5,6]);
a.destroy();
});
it('should allow replacing items', function () {
var a;
a = $b.Array.create([0,2,3]);
expect(a.content).to.deep.equal([0,2,3]);
a.replace(0,1);
expect(a.content).to.deep.equal([1,2,3]);
a.destroy();
});
it('should allow replacing with replaceAt()', function () {
var a;
a = $b.Array.create([1,2,3,0]);
expect(a.content).to.deep.equal([1,2,3,0]);
a.replaceAt(3,4);
expect(a.content).to.deep.equal([1,2,3,4]);
a.destroy();
});
it('should call watchers on addition of items', function (done) {

@@ -37,2 +175,3 @@

expect(a.getChanges().added.length).to.equal(3);
a.destroy();
done();

@@ -42,3 +181,2 @@ });

a.push(4,5,6);
});

@@ -54,2 +192,3 @@

expect(a.getChanges().removed[0].item).to.equal(1);
a.destroy();
done();

@@ -59,6 +198,3 @@ });

a.removeAt(0);
});
});

@@ -19,4 +19,4 @@ describe('construction', function () {

instance.destroy();
done();
});

@@ -43,4 +43,3 @@

Class().create();
Class().create().destroy();
});

@@ -61,2 +60,3 @@

instance.destroy();
done();

@@ -63,0 +63,0 @@ });

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

describe("$b.Class", function () {
describe('Brink.Class', function () {

@@ -19,5 +19,5 @@ before (function () {

require("./construction");
require("./destruction");
require("./publish-subscribe");
require('./construction');
require('./destruction');
require('./publish-subscribe');

@@ -24,0 +24,0 @@ after (function () {

@@ -81,2 +81,4 @@ describe('pub/sub', function () {

if (didHold) {
instance.destroy();
instance2.destroy();
done();

@@ -99,2 +101,4 @@ }

setTimeout(function () {
instance.destroy();
instance2.destroy();
done();

@@ -105,2 +109,4 @@ }, 10);

instance2.subscribe('cancel-test-2', function (n) {
instance.destroy();
instance2.destroy();
done(false);

@@ -131,2 +137,3 @@ });

instance.destroy();
done();

@@ -133,0 +140,0 @@ });

describe('bindings', function () {
it('should two-way data bind between $b.Object instances when using $b.bindTo()', function (done) {
it('should two-way data bind between $b.Object instances when using $b.bindTo()', function () {

@@ -26,6 +26,7 @@ var a,

done();
a.destroy();
b.destroy();
});
it('should two-way data bind between $b.Object instances when using bindProperty()', function (done) {
it('should two-way data bind between $b.Object instances when using bindProperty()', function () {

@@ -57,6 +58,7 @@ var a,

done();
a.destroy();
b.destroy();
});
it('should be able to bind to nested properties', function (done) {
it('should be able to bind to nested properties', function () {

@@ -86,5 +88,7 @@ var a,

done();
a.destroy();
b.destroy();
c.destroy();
});
});

@@ -26,2 +26,3 @@ describe('computed properties', function () {

expect(a.sum).to.equal(15);
a.destroy();
done();

@@ -31,4 +32,2 @@ });

});
});
describe('construction', function () {
it('should run the init method', function (done) {
it('should run the init method', function () {

@@ -21,7 +21,6 @@ var Obj,

done();
instance.destroy();
});
it('should be an instance of it\'s parent Classes', function (done) {
it('should be an instance of it\'s parent Classes', function () {

@@ -39,5 +38,5 @@ var Obj,

done();
instance.destroy();
});
});

@@ -26,2 +26,4 @@ describe('destruction', function () {

done();
$b('TestObj').prototype.destroy.call(this);
}

@@ -28,0 +30,0 @@ });

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

describe("$b.Object", function () {
describe('Brink.Object', function () {

@@ -19,7 +19,7 @@ before (function () {

require("./construction");
require("./destruction");
require("./bindings");
require("./watchers");
require("./computed");
require('./construction');
require('./destruction');
require('./bindings');
require('./watchers');
require('./computed');

@@ -26,0 +26,0 @@ after (function () {

@@ -62,2 +62,6 @@ describe('watchers', function () {

var a,
b,
c;
a = $b.Object.create({

@@ -64,0 +68,0 @@ test1 : 1

@@ -12,3 +12,3 @@ var p,

path = require('path');
chai = require("chai"),
chai = require('chai'),
mocha = require('mocha');

@@ -20,3 +20,3 @@

});
mocha.checkLeaks();
global.expect = chai.expect;

@@ -23,0 +23,0 @@

Sorry, the diff of this file is not supported yet

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