Socket
Socket
Sign inDemoInstall

007

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0 to 0.0.1

.travis.yml

42

007.js

@@ -6,3 +6,2 @@

var mockFn = function () {
console.log(mockFn);
mockFn.callHistory.push(Array.prototype.slice.call(arguments, 0));

@@ -38,16 +37,31 @@ mockFn.callCount += 1;

module.exports = function doubleOhSeven (api) {
if (typeof api === 'function') {
return makeMockFn();
} else if (api instanceof Array) {
return api.map(doubleOhSeven);
} else if (api !== null && typeof api === 'object') {
return Object.keys(api).
reduce(function (newObj, prop) {
module.exports = function (api) {
var originals = [],
mocks = [];
return (function doubleOhSeven (api) {
var mock;
if (originals.indexOf(api) !== -1) {
return mocks[originals.indexOf(api)];
} else if (typeof api === 'function') {
mock = makeMockFn();
} else if (api instanceof Array) {
mock = api.map(doubleOhSeven);
} else if (api !== null && typeof api === 'object') {
mock = {};
} else { // not a fn, obj, or array
return api;
}
originals.push(api);
mocks.push(mock);
if (typeof api === 'object') {
Object.keys(api).
reduce(function (newObj, prop) {
newObj[prop] = doubleOhSeven(api[prop]);
return newObj;
}, {});
} else { // not a fn, obj, or array
return api;
}
return newObj;
}, mock);
}
return mock;
}(api));
};
{
"name": "007",
"version": "0.0.0",
"version": "0.0.1",
"description": "Returns a deep copy of an object with all functions converted to spies",
"main": "007.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha tests/"
},

@@ -23,3 +23,7 @@ "repository": {

"url": "https://github.com/btford/007/issues"
},
"devDependencies": {
"should": "~1.2.2",
"mocha": "~1.12.0"
}
}
# 007
[![Build Status](https://travis-ci.org/btford/007.png?branch=master)](https://travis-ci.org/btford/007)

@@ -64,3 +65,3 @@ Returns a deep copy of an object with all functions converted to spies.

#### `mockFn.callbackArgs`
#### `mockFn.callbackArgs()`

@@ -67,0 +68,0 @@ The callback args to be invoked by the mock.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc