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

bondjs

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bondjs - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

54

lib/bond.js
// Generated by CoffeeScript 2.0.0-beta8
void function () {
var allStubs, arrayEqual, bond, createAnonymousSpy, createReturnSpy, createThroughSpy, enhanceSpy, isFunction, nextTick, registerCleanupHook, registered;
var _find, _registry, allStubs, arrayEqual, bond, createAnonymousSpy, createReturnSpy, createThroughSpy, enhanceSpy, isFunction, nextTick, registerCleanupHook, registered, registry;
isFunction = function (obj) {

@@ -90,2 +90,42 @@ return typeof obj === 'function';

}();
_registry = [];
_find = function (obj) {
var store;
for (var i$ = 0, length$ = _registry.length; i$ < length$; ++i$) {
store = _registry[i$];
if (store.obj === obj)
return store;
}
store = {
obj: obj,
props: {}
};
_registry.push(store);
return store;
};
registry = {
set: function (obj, prop, value, newValue) {
var store;
store = _find(obj);
if (!(null != store.props[prop]))
return store.props[prop] = value;
},
get: function (obj, prop) {
return _find(obj).props[prop];
},
restore: function (obj, prop) {
return obj[prop] = _find(obj).props[prop];
},
restoreAll: function () {
var prop, store, value;
for (var i$ = 0, length$ = _registry.length; i$ < length$; ++i$) {
store = _registry[i$];
for (prop in store.props) {
value = store.props[prop];
store.obj[prop] = value;
}
}
return _registry = [];
}
};
allStubs = [];

@@ -101,8 +141,3 @@ registered = false;

after(function () {
var stubRestore;
for (var i$ = 0, length$ = allStubs.length; i$ < length$; ++i$) {
stubRestore = allStubs[i$];
stubRestore();
}
return allStubs = [];
return registry.restoreAll();
});

@@ -118,6 +153,6 @@ return registered = true;

registerRestore = function () {
return allStubs.push(restore);
return registry.set(obj, property, previous);
};
restore = function () {
return obj[property] = previous;
return registry.restore(obj, property);
};

@@ -159,2 +194,3 @@ to = function (newValue) {

through = function () {
registerRestore();
obj[property] = createThroughSpy(previous, this);

@@ -161,0 +197,0 @@ return obj[property];

4

package.json
{
"name": "bondjs",
"version": "1.2.1",
"version": "1.2.2",
"description": "simple js stub/spy library",

@@ -14,3 +14,3 @@ "license": "MIT",

"compile": "./node_modules/.bin/coffee --js <bond.coffee >lib/bond.js",
"test": "./node_modules/.bin/mocha --compilers coffee:coffee-script-redux/register --reporter spec --colors test.coffee"
"test": "npm run compile && ./node_modules/.bin/mocha --compilers coffee:coffee-script-redux/register --reporter spec --colors test.coffee"
},

@@ -17,0 +17,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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