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

evil-diff

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evil-diff - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

lib/isObject.d.ts

7

lib/index.d.ts

@@ -1,3 +0,4 @@

export { default as revise } from "./revise";
export { default as reviseFn } from "./reviseFn";
export { default as retainFn } from "./retainFn";
export { revise } from './revise';
export { reviseFn } from './reviseFn';
export { retainFn } from './retainFn';
export { reviseReducer } from './reviseReducer';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var revise_1 = require("./revise");
exports.revise = revise_1.default;
exports.revise = revise_1.revise;
var reviseFn_1 = require("./reviseFn");
exports.reviseFn = reviseFn_1.default;
exports.reviseFn = reviseFn_1.reviseFn;
var retainFn_1 = require("./retainFn");
exports.retainFn = retainFn_1.default;
exports.retainFn = retainFn_1.retainFn;
var reviseReducer_1 = require("./reviseReducer");
exports.reviseReducer = reviseReducer_1.reviseReducer;

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

declare const retain: <T>(fn: () => T) => () => T;
export default retain;
export declare type callback<K, A, M> = (this: K, ...args: A[]) => M;
export declare const retainFn: <K, A, M>(fn: callback<K, A, M>) => (...args: A[]) => M;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = require("lodash");
const shallowArrayEqual_1 = require("./shallowArrayEqual");
const retain = (fn) => {
exports.retainFn = (fn) => {
let lastArgs;
let output;
return function () {
const newArgs = lodash_1.toArray(arguments);
const unchanged = shallowArrayEqual_1.default(lastArgs, newArgs);
return function (...newArgs) {
const unchanged = shallowArrayEqual_1.shallowArrayEqual(lastArgs, newArgs);
if (!unchanged) {
output = fn.apply(this, newArgs);
lastArgs = lodash_1.toArray(newArgs);
lastArgs = newArgs;
}

@@ -18,2 +16,1 @@ return output;

};
exports.default = retain;

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

declare const revise: <T>(source: T, revision: T) => T;
export default revise;
export declare const revise: <T>(source: T, revision: T) => T;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const walkTree_1 = require("./walkTree");
const revise = (source, revision) => {
return walkTree_1.default(source, revision);
exports.revise = (source, revision) => {
return walkTree_1.walkTree(source, revision);
};
exports.default = revise;

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

declare const reviseOutput: <T>(fn: () => T) => () => T;
export default reviseOutput;
export declare type callback<K, A, M> = (this: K, ...args: A[]) => M;
export declare const reviseFn: <K, A, M>(fn: callback<K, A, M>) => (...args: A[]) => M;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const revise_1 = require("./revise");
const reviseOutput = (fn) => {
exports.reviseFn = (fn) => {
let source;
return function () {
const revision = fn.apply(this, arguments);
source = revise_1.default(source, revision);
return function (...args) {
const revision = fn.apply(this, args);
source = revise_1.revise(source, revision);
return source;
};
};
exports.default = reviseOutput;

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

declare const shallowArrayEqual: (arr1: any[], arr2: any[]) => boolean;
export default shallowArrayEqual;
export declare const shallowArrayEqual: (arr1: {}[], arr2: {}[]) => boolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const shallowArrayEqual = (arr1, arr2) => {
exports.shallowArrayEqual = (arr1, arr2) => {
if (!arr1 || !arr2) {

@@ -17,2 +17,1 @@ return false;

};
exports.default = shallowArrayEqual;

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

declare const walkTree: <T>(source: T, revision: T) => T;
export default walkTree;
export declare const walkTree: <T>(source: T, revision: T) => T;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const walkTree = (source, revision) => {
const isObject_1 = require("./isObject");
const shallowClone_1 = require("./shallowClone");
exports.walkTree = (source, revision) => {
if (source === revision) {
return source;
}
if (!isObject_1.isObject(source) || !isObject_1.isObject(revision)) {
return revision;
}
const matchingType = source instanceof revision.constructor &&

@@ -12,7 +17,3 @@ revision instanceof source.constructor;

}
if (typeof source !== "object" || typeof revision !== "object") {
return revision;
}
const sourceKeys = Object.keys(source);
const revisionKeys = Object.keys(revision);
let changed = false;

@@ -22,9 +23,8 @@ for (const key of sourceKeys) {

const revisionValue = revision[key];
const newValue = walkTree(sourceValue, revisionValue);
const newValue = exports.walkTree(sourceValue, revisionValue);
if (newValue === sourceValue) {
continue;
}
if (!changed) {
const base = Array.isArray(source) ? [] : {};
source = Object.assign(base, source);
if (!changed && isObject_1.isObject(source)) {
source = shallowClone_1.shallowClone(source);
changed = true;

@@ -36,2 +36,1 @@ }

};
exports.default = walkTree;
{
"name": "evil-diff",
"version": "0.0.0",
"description": "evil-diff",
"license": "MIT",
"repository": "",
"author": "",
"keywords": [
""
],
"files": [
"lib"
],
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"scripts": {
"clean": "rimraf lib",
"lint": "tslint --force --fix --format verbose \"src/**/*.ts\"",
"version": "tsc --version",
"build": "npm run clean && npm run lint && echo Using TypeScript && tsc --version && tsc --pretty",
"test": "npm run build && mocha --compilers ts:ts-node/register --recursive 'test/**/*-spec.ts' 'src/**/*.ts'",
"coverage": "nyc --include='src/**/*.ts' --reporter=text --reporter=html --reporter=lcov mocha --compilers ts:ts-node/register --recursive 'test/**/*-spec.ts'",
"watch": "npm run build -- --watch",
"watch:test": "npm run test -- --watch"
},
"dependencies": {
"core-js": "^2.4.1",
"fast-json-patch": "^1.1.10",
"lodash": "^4.17.4"
},
"devDependencies": {
"@types/chai": "^3.0.0",
"@types/core-js": "^0.9.41",
"@types/lodash": "^4.14.64",
"@types/mocha": "^2.0.0",
"@types/sinon": "^2.2.2",
"chai": "^3.0.0",
"coveralls": "^2.0.0",
"mocha": "^3.0.0",
"nyc": "^10.0.0",
"rimraf": "^2.0.0",
"sinon": "^2.2.0",
"ts-node": "^3.0.0",
"tslint": "^5.0.0",
"typescript": "^2.0.0"
},
"engines": {
"node": ">=4.0.0"
},
"nyc": {
"include": [
"src/**/*.ts"
"name": "evil-diff",
"version": "0.0.1",
"description": "evil-diff",
"license": "MIT",
"repository": "",
"author": "",
"keywords": [],
"files": [
"lib"
],
"exclude": [
"lib"
],
"extension": [
".ts"
],
"require": [
"ts-node/register"
],
"reporter": [],
"all": true
}
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"scripts": {
"benchmark": "ts-node test/*-benchmark.ts --no-cache",
"check": "gts check",
"clean": "gts clean",
"compile": "tsc -p .",
"coverage": "nyc --include='src/**/*.ts' --reporter=text --reporter=html --reporter=lcov mocha --compilers ts:ts-node/register --recursive 'test/**/*-spec.ts'",
"fix": "gts fix",
"lint": "tslint --type-check --force --fix --project tsconfig.json --format verbose \"src/**/*.ts\"",
"posttest": "yarn run check",
"prepare": "yarn run compile",
"pretest": "yarn run lint && yarn run check && yarn run compile",
"test": "yarn run pretest && mocha --compilers ts:ts-node/register --recursive 'test/**/*-spec.ts' 'src/**/*.ts' && yarn run posttest",
"version": "tsc --version",
"watch": "yarn run compile -- --watch",
"watch:test": "yarn run test -- --watch"
},
"dependencies": {},
"devDependencies": {
"@types/benchmark": "^1.0.30",
"@types/chai": "^3.0.0",
"@types/mocha": "^2.0.0",
"@types/node": "^8.0.33",
"@types/sinon": "^2.2.2",
"benchmark": "^2.1.4",
"chai": "^3.0.0",
"coveralls": "^2.0.0",
"gts": "latest",
"mocha": "^3.0.0",
"nyc": "^10.0.0",
"redux": "^3.7.2",
"rimraf": "^2.0.0",
"sinon": "^2.2.0",
"ts-node": "^3.3.0",
"tslint": "^5.5.0",
"tslint-eslint-rules": "^4.1.1",
"typescript": "^2.4.1"
},
"engines": {
"node": ">=4.0.0"
},
"nyc": {
"include": [
"src/**/*.ts"
],
"exclude": [
"lib"
],
"extension": [
".ts"
],
"require": [
"ts-node/register"
],
"reporter": [],
"all": true
}
}

@@ -0,5 +1,6 @@

[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
[![Build Status](https://travis-ci.org/KamranAsif/evil-diff.svg?branch=master)](https://travis-ci.org/KamranAsif/evil-diff.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/KamranAsif/evil-diff/badge.svg?branch=master)](https://coveralls.io/github/KamranAsif/evil-diff?branch=master)
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
[![npm version](https://badge.fury.io/js/fixed-data-table-2.svg)](https://www.npmjs.com/package/fixed-data-table-2)
# Evil Diff

@@ -6,0 +7,0 @@

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