alternative-facts
Advanced tools
Comparing version 1.0.3 to 2.0.0
80
index.js
@@ -1,8 +0,13 @@ | ||
'use strict'; | ||
"use strict"; | ||
var shuffle = require('shuffle-words'); | ||
var scramble = require('scramble'); | ||
require('./tools/array'); | ||
var blacklist = []; | ||
var fuxor = require('fuxor'); | ||
var Stochator = require('stochator'); | ||
@@ -25,32 +30,39 @@ | ||
if (typeof module[prop] === 'function' && blacklist.includes(prop)) { | ||
(function () { | ||
var origMethod = module[prop]; | ||
module[prop] = function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var origMethod = module[prop]; | ||
var result = origMethod.apply(this, args); | ||
if (!blacklist.includes(prop)) { | ||
return result; | ||
} | ||
if (typeof result === 'string') { | ||
return result + scramble(result); | ||
} | ||
if (typeof result === 'array') { | ||
return scramble(result); | ||
} | ||
if (typeof result === 'array') { | ||
return scramble(result); | ||
} | ||
if (typeof result === 'boolean') { | ||
return !result; | ||
} | ||
if (typeof result === 'number') { | ||
return numberGen(result); | ||
} | ||
module[prop] = function () { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var result = origMethod.apply(this, args); | ||
if (!blacklist.includes(prop)) { | ||
return result; | ||
}; | ||
})(); | ||
} | ||
if (typeof result === 'string') { | ||
return result + scramble(result); | ||
} | ||
if (typeof result === 'array') { | ||
return scramble(result); | ||
} | ||
if (typeof result === 'array') { | ||
return scramble(result); | ||
} | ||
if (typeof result === 'boolean') { | ||
return !result; | ||
} | ||
if (typeof result === 'number') { | ||
return numberGen(result); | ||
} | ||
return result; | ||
}; | ||
} | ||
if (typeof module[prop] === 'string' && blacklist.includes(prop)) { | ||
@@ -65,2 +77,3 @@ if (!trumpedProperties.has(prop)) { | ||
} | ||
if (typeof module[prop] === 'number' && blacklist.includes(prop)) { | ||
@@ -71,2 +84,3 @@ if (!trumpedProperties.has(prop)) { | ||
var newNumber = numberGen(_origProp); | ||
if (newNumber !== _origProp) { | ||
@@ -81,2 +95,3 @@ module[prop] = newNumber; | ||
} | ||
if (typeof module[prop] === 'boolean' && blacklist.includes(prop)) { | ||
@@ -97,4 +112,6 @@ if (!trumpedProperties.has(prop)) { | ||
} | ||
return module; | ||
}; | ||
fuxor.wrap(wrapper); | ||
@@ -106,8 +123,5 @@ | ||
}; | ||
var af = function af() { | ||
for (var _len2 = arguments.length, methodsToChange = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
methodsToChange[_key2] = arguments[_key2]; | ||
} | ||
blacklist.push.apply(blacklist, methodsToChange); | ||
blacklist.push.apply(blacklist, arguments); | ||
return { | ||
@@ -114,0 +128,0 @@ reset: function reset() { |
{ | ||
"name": "alternative-facts", | ||
"version": "1.0.3", | ||
"version": "2.0.0", | ||
"description": "JS lib that intercepts code and delivers incorrect values", | ||
@@ -8,4 +8,4 @@ "main": "index.js", | ||
"build": "babel ./src -d .", | ||
"test": "ava", | ||
"watch": "ava --watch" | ||
"test": "mocha", | ||
"watch": "mocha --watch" | ||
}, | ||
@@ -25,6 +25,6 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/Kevnz/alternative-facts#readme", | ||
"homepage": "http://kevinisom.info/alternative-facts/", | ||
"dependencies": { | ||
"fuxor": "^2.2.1", | ||
"randomatic": "^1.1.6", | ||
"fuxor": "^2.2.2", | ||
"randomatic": "^3.1.1", | ||
"scramble": "0.0.4", | ||
@@ -35,6 +35,11 @@ "shuffle-words": "^0.1.2", | ||
"devDependencies": { | ||
"ava": "^0.18.1", | ||
"babel-cli": "^6.22.2", | ||
"babel-preset-env": "^1.1.8" | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.3.3", | ||
"@babel/preset-env": "^7.3.1", | ||
"@kev_nz/eslint-config": "^3.2.0", | ||
"@kev_nz/publisher": "^1.0.1", | ||
"chai": "^4.2.0", | ||
"eslint": "^5.14.1", | ||
"mocha": "^6.0.0" | ||
} | ||
} |
@@ -0,3 +1,5 @@ | ||
# Alternative-Facts | ||
[![Build Status](https://travis-ci.org/Kevnz/fuxor.png?branch=master)](https://travis-ci.org/Kevnz/alternative-facts) | ||
# alternative-facts | ||
## When you want to make the truth false. | ||
@@ -8,7 +10,9 @@ | ||
### API | ||
#### Setup | ||
```:javascript | ||
```js | ||
// require | ||
const alternativeFacts = require('alternative-facts') | ||
const af = alternativeFacts('format'); | ||
const af = alternativeFacts('format'); | ||
//override any method or property named format | ||
@@ -22,3 +26,4 @@ const util = require('util'); | ||
#### reset | ||
```:javascript | ||
```js | ||
af.reset(); | ||
@@ -31,3 +36,3 @@ const util2 = require('util'); | ||
#### init | ||
```:javascript | ||
```js | ||
af.reset(); | ||
@@ -39,3 +44,1 @@ af.init('format'); | ||
``` | ||
@@ -20,4 +20,6 @@ const shuffle = require('shuffle-words'); | ||
const wrapper = (module) => { | ||
for (let prop in module) { | ||
if (module.hasOwnProperty(prop)) { | ||
if (typeof module[prop] === 'function' && blacklist.includes(prop)) { | ||
@@ -48,2 +50,3 @@ const origMethod = module[prop]; | ||
} | ||
if (typeof module[prop] === 'string' && blacklist.includes(prop)) { | ||
@@ -50,0 +53,0 @@ if (!trumpedProperties.has(prop)) { |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -9,9 +9,13 @@ if (!Array.prototype.includes) { | ||
} | ||
var o = Object(this); | ||
var len = o.length >>> 0; | ||
if (len === 0) { | ||
return false; | ||
} | ||
var n = fromIndex | 0; | ||
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); | ||
while (k < len) { | ||
@@ -21,4 +25,6 @@ if (o[k] === searchElement) { | ||
} | ||
k++; | ||
} | ||
return false; | ||
@@ -25,0 +31,0 @@ } |
@@ -1,4 +0,5 @@ | ||
'use strict'; | ||
"use strict"; | ||
var util = require('util'); | ||
module.exports = { | ||
@@ -5,0 +6,0 @@ xformat: function xformat(base, arg1, arg2) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
19340
16
519
41
0
8
+ Addedis-number@4.0.0(transitive)
+ Addedkind-of@6.0.3(transitive)
+ Addedmath-random@1.0.4(transitive)
+ Addedrandomatic@3.1.1(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedis-number@3.0.0(transitive)
- Removedkind-of@3.2.24.0.0(transitive)
- Removedrandomatic@1.1.7(transitive)
Updatedfuxor@^2.2.2
Updatedrandomatic@^3.1.1