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

alternative-facts

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alternative-facts - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

.babelrc

130

index.js

@@ -1,10 +0,12 @@

const shuffle = require('shuffle-words');
const scramble = require('scramble');
'use strict';
var shuffle = require('shuffle-words');
var scramble = require('scramble');
require('./tools/array');
const blacklist = [];
const fuxor = require('fuxor');
const Stochator = require('stochator');
var blacklist = [];
var fuxor = require('fuxor');
var Stochator = require('stochator');
const numberGen = function (number) {
const gen = new Stochator({
var numberGen = function numberGen(number) {
var gen = new Stochator({
kind: 'integer',

@@ -17,41 +19,45 @@ min: 0,

const trumpedProperties = new Map();
var trumpedProperties = new Map();
const wrapper = (module) => {
for (let prop in module) {
var wrapper = function wrapper(module) {
var _loop = function _loop(prop) {
if (module.hasOwnProperty(prop)) {
if (typeof module[prop] === 'function' && blacklist.includes(prop)) {
const origMethod = module[prop];
module[prop] = function (...args) {
const result = origMethod.apply(this, args);
if (!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 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 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)) {
if (!trumpedProperties.has(prop)) {
const origProp = module[prop];
var origProp = module[prop];
trumpedProperties.set(prop, origProp);
module[prop] = scramble(origProp);
}
} else if(typeof module[prop] === 'string'
&& !blacklist.includes(prop)
&& trumpedProperties.has(prop)) {
} else if (typeof module[prop] === 'string' && !blacklist.includes(prop) && trumpedProperties.has(prop)) {
module[prop] = trumpedProperties.get(prop);

@@ -61,14 +67,12 @@ }

if (!trumpedProperties.has(prop)) {
const origProp = module[prop];
trumpedProperties.set(prop, origProp);
const newNumber = numberGen(origProp);
if (newNumber !== origProp) {
module[prop] = newNumber
var _origProp = module[prop];
trumpedProperties.set(prop, _origProp);
var newNumber = numberGen(_origProp);
if (newNumber !== _origProp) {
module[prop] = newNumber;
} else {
module[prop] = numberGen(origProp);
module[prop] = numberGen(_origProp);
}
}
} else if(typeof module[prop] === 'number'
&& !blacklist.includes(prop)
&& trumpedProperties.has(prop)) {
} else if (typeof module[prop] === 'number' && !blacklist.includes(prop) && trumpedProperties.has(prop)) {
module[prop] = trumpedProperties.get(prop);

@@ -78,12 +82,14 @@ }

if (!trumpedProperties.has(prop)) {
const origProp = module[prop];
trumpedProperties.set(prop, origProp);
module[prop] = !origProp;
var _origProp2 = module[prop];
trumpedProperties.set(prop, _origProp2);
module[prop] = !_origProp2;
}
} else if(typeof module[prop] === 'boolean'
&& !blacklist.includes(prop)
&& trumpedProperties.has(prop)) {
} else if (typeof module[prop] === 'boolean' && !blacklist.includes(prop) && trumpedProperties.has(prop)) {
module[prop] = trumpedProperties.get(prop);
}
}
};
for (var prop in module) {
_loop(prop);
}

@@ -94,20 +100,24 @@ return module;

const clear = () => {
var clear = function clear() {
fuxor.clear();
blacklist.empty();
}
const af = function (...methodsToChange) {
blacklist.push(...methodsToChange);
};
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);
return {
reset: () => {
reset: function reset() {
clear();
},
init: (...methodsToChange) => {
init: function init() {
clear();
blacklist.push(...methodsToChange);
blacklist.push.apply(blacklist, arguments);
fuxor.wrap(wrapper);
}
}
};
};
module.exports = af
module.exports = af;
{
"name": "alternative-facts",
"version": "1.0.2",
"version": "1.0.3",
"description": "JS lib that intercepts code and delivers incorrect values",
"main": "index.js",
"scripts": {
"build": "babel ./src -d .",
"test": "ava",

@@ -32,4 +33,6 @@ "watch": "ava --watch"

"devDependencies": {
"ava": "^0.18.1"
"ava": "^0.18.1",
"babel-cli": "^6.22.2",
"babel-preset-env": "^1.1.8"
}
}

@@ -0,14 +1,16 @@

'use strict';
if (!Array.prototype.includes) {
Object.defineProperty(Array.prototype, 'includes', {
value: function(searchElement, fromIndex) {
value: function value(searchElement, fromIndex) {
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
const o = Object(this);
const len = o.length >>> 0;
var o = Object(this);
var len = o.length >>> 0;
if (len === 0) {
return false;
}
const n = fromIndex | 0;
let k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
var n = fromIndex | 0;
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {

@@ -27,7 +29,6 @@ if (o[k] === searchElement) {

Object.defineProperty(Array.prototype, 'empty', {
value: function(searchElement, fromIndex) {
value: function value(searchElement, fromIndex) {
this.splice(0, this.length);
}
});
}
}

@@ -1,4 +0,6 @@

const util = require('util')
'use strict';
var util = require('util');
module.exports = {
xformat: function (base, arg1, arg2) {
xformat: function xformat(base, arg1, arg2) {
return util.format(base, arg1, arg2);

@@ -9,11 +11,11 @@ },

number: 21,
strings: function() {
strings: function strings() {
return 'This is another string';
},
numbers: function() {
numbers: function numbers() {
return 42;
},
bools: function () {
bools: function bools() {
return false;
}
}
};
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