quill-delta
Advanced tools
Comparing version 4.2.1 to 4.2.2
@@ -0,1 +1,5 @@ | ||
## v4.2.2 | ||
- Switch dependent internal utility functions to lodash family | ||
## v4.2.1 | ||
@@ -2,0 +6,0 @@ |
@@ -6,4 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var deep_equal_1 = __importDefault(require("deep-equal")); | ||
var extend_1 = __importDefault(require("extend")); | ||
var lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep")); | ||
var lodash_isequal_1 = __importDefault(require("lodash.isequal")); | ||
var AttributeMap; | ||
@@ -20,3 +20,3 @@ (function (AttributeMap) { | ||
} | ||
var attributes = extend_1.default(true, {}, b); | ||
var attributes = lodash_clonedeep_1.default(b); | ||
if (!keepNull) { | ||
@@ -50,3 +50,3 @@ attributes = Object.keys(attributes).reduce(function (copy, key) { | ||
.reduce(function (attrs, key) { | ||
if (!deep_equal_1.default(a[key], b[key])) { | ||
if (!lodash_isequal_1.default(a[key], b[key])) { | ||
attrs[key] = b[key] === undefined ? null : b[key]; | ||
@@ -53,0 +53,0 @@ } |
@@ -5,5 +5,5 @@ "use strict"; | ||
}; | ||
var deep_equal_1 = __importDefault(require("deep-equal")); | ||
var extend_1 = __importDefault(require("extend")); | ||
var fast_diff_1 = __importDefault(require("fast-diff")); | ||
var lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep")); | ||
var lodash_isequal_1 = __importDefault(require("lodash.isequal")); | ||
var AttributeMap_1 = __importDefault(require("./AttributeMap")); | ||
@@ -59,3 +59,3 @@ var Op_1 = __importDefault(require("./Op")); | ||
var lastOp = this.ops[index - 1]; | ||
newOp = extend_1.default(true, {}, newOp); | ||
newOp = lodash_clonedeep_1.default(newOp); | ||
if (typeof lastOp === 'object') { | ||
@@ -77,3 +77,3 @@ if (typeof newOp.delete === 'number' && | ||
} | ||
if (deep_equal_1.default(newOp.attributes, lastOp.attributes)) { | ||
if (lodash_isequal_1.default(newOp.attributes, lastOp.attributes)) { | ||
if (typeof newOp.insert === 'string' && | ||
@@ -214,3 +214,3 @@ typeof lastOp.insert === 'string') { | ||
if (!otherIter.hasNext() && | ||
deep_equal_1.default(delta.ops[delta.ops.length - 1], newOp)) { | ||
lodash_isequal_1.default(delta.ops[delta.ops.length - 1], newOp)) { | ||
var rest = new Delta(thisIter.rest()); | ||
@@ -275,3 +275,3 @@ return delta.concat(rest).chop(); | ||
var otherOp = otherIter.next(opLength); | ||
if (deep_equal_1.default(thisOp.insert, otherOp.insert)) { | ||
if (lodash_isequal_1.default(thisOp.insert, otherOp.insert)) { | ||
retDelta.retain(opLength, AttributeMap_1.default.diff(thisOp.attributes, otherOp.attributes)); | ||
@@ -278,0 +278,0 @@ } |
{ | ||
"name": "quill-delta", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "Format for representing rich text documents and changes.", | ||
@@ -9,17 +9,19 @@ "author": "Jason Chen <jhchen7@gmail.com>", | ||
"dependencies": { | ||
"deep-equal": "^1.0.1", | ||
"extend": "^3.0.2", | ||
"fast-diff": "1.2.0" | ||
"fast-diff": "1.2.0", | ||
"lodash.clonedeep": "^4.5.0", | ||
"lodash.isequal": "^4.5.0" | ||
}, | ||
"devDependencies": { | ||
"@types/deep-equal": "^1.0.1", | ||
"@types/extend": "^3.0.0", | ||
"coveralls": "^3.0.2", | ||
"@types/lodash.clonedeep": "^4.5.0", | ||
"@types/lodash.isequal": "^4.5.0", | ||
"@typescript-eslint/eslint-plugin": "^2.28.0", | ||
"@typescript-eslint/parser": "^2.28.0", | ||
"coveralls": "^3.0.11", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.1", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"istanbul": "~0.4.5", | ||
"jasmine": "^3.3.1", | ||
"prettier": "^1.16.4", | ||
"tslint": "^5.12.1", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"typescript": "^3.3.3" | ||
"jasmine": "^3.5.0", | ||
"prettier": "^2.0.4", | ||
"typescript": "^3.8.3" | ||
}, | ||
@@ -35,3 +37,3 @@ "files": [ | ||
"prepare": "npm run build", | ||
"lint": "tslint 'src/**/*.ts'", | ||
"lint": "eslint 'src/**/*.ts'", | ||
"test": "npm run build; jasmine test/*.js test/**/*.js", | ||
@@ -41,2 +43,25 @@ "test:coverage": "istanbul cover jasmine test/*.js test/**/*.js", | ||
}, | ||
"eslintConfig": { | ||
"parser": "@typescript-eslint/parser", | ||
"extends": [ | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier/@typescript-eslint", | ||
"plugin:prettier/recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"@typescript-eslint/ban-ts-ignore": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-namespace": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
"argsIgnorePattern": "^_" | ||
} | ||
] | ||
} | ||
}, | ||
"prettier": { | ||
@@ -43,0 +68,0 @@ "singleQuote": true, |
@@ -1,3 +0,3 @@ | ||
import equal from 'deep-equal'; | ||
import extend from 'extend'; | ||
import cloneDeep from 'lodash.clonedeep'; | ||
import isEqual from 'lodash.isequal'; | ||
@@ -20,3 +20,3 @@ interface AttributeMap { | ||
} | ||
let attributes = extend(true, {}, b); | ||
let attributes = cloneDeep(b); | ||
if (!keepNull) { | ||
@@ -51,3 +51,3 @@ attributes = Object.keys(attributes).reduce<AttributeMap>((copy, key) => { | ||
.reduce<AttributeMap>((attrs, key) => { | ||
if (!equal(a[key], b[key])) { | ||
if (!isEqual(a[key], b[key])) { | ||
attrs[key] = b[key] === undefined ? null : b[key]; | ||
@@ -60,3 +60,6 @@ } | ||
export function invert(attr: AttributeMap = {}, base: AttributeMap = {}) { | ||
export function invert( | ||
attr: AttributeMap = {}, | ||
base: AttributeMap = {}, | ||
): AttributeMap { | ||
attr = attr || {}; | ||
@@ -80,3 +83,3 @@ const baseInverted = Object.keys(base).reduce<AttributeMap>((memo, key) => { | ||
b: AttributeMap | undefined, | ||
priority: boolean = false, | ||
priority = false, | ||
): AttributeMap | undefined { | ||
@@ -83,0 +86,0 @@ if (typeof a !== 'object') { |
@@ -1,4 +0,4 @@ | ||
import equal from 'deep-equal'; | ||
import extend from 'extend'; | ||
import diff from 'fast-diff'; | ||
import cloneDeep from 'lodash.clonedeep'; | ||
import isEqual from 'lodash.isequal'; | ||
import AttributeMap from './AttributeMap'; | ||
@@ -66,3 +66,3 @@ import Op from './Op'; | ||
let lastOp = this.ops[index - 1]; | ||
newOp = extend(true, {}, newOp); | ||
newOp = cloneDeep(newOp); | ||
if (typeof lastOp === 'object') { | ||
@@ -86,3 +86,3 @@ if ( | ||
} | ||
if (equal(newOp.attributes, lastOp.attributes)) { | ||
if (isEqual(newOp.attributes, lastOp.attributes)) { | ||
if ( | ||
@@ -140,3 +140,3 @@ typeof newOp.insert === 'string' && | ||
const failed: Op[] = []; | ||
this.forEach(op => { | ||
this.forEach((op) => { | ||
const target = predicate(op) ? passed : failed; | ||
@@ -172,3 +172,3 @@ target.push(op); | ||
slice(start: number = 0, end: number = Infinity): Delta { | ||
slice(start = 0, end = Infinity): Delta { | ||
const ops = []; | ||
@@ -243,3 +243,3 @@ const iter = Op.iterator(this.ops); | ||
!otherIter.hasNext() && | ||
equal(delta.ops[delta.ops.length - 1], newOp) | ||
isEqual(delta.ops[delta.ops.length - 1], newOp) | ||
) { | ||
@@ -276,5 +276,5 @@ const rest = new Delta(thisIter.rest()); | ||
} | ||
const strings = [this, other].map(delta => { | ||
const strings = [this, other].map((delta) => { | ||
return delta | ||
.map(op => { | ||
.map((op) => { | ||
if (op.insert != null) { | ||
@@ -292,3 +292,3 @@ return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER; | ||
const otherIter = Op.iterator(other.ops); | ||
diffResult.forEach(component => { | ||
diffResult.forEach((component: diff.Diff) => { | ||
let length = component[1].length; | ||
@@ -315,3 +315,3 @@ while (length > 0) { | ||
const otherOp = otherIter.next(opLength); | ||
if (equal(thisOp.insert, otherOp.insert)) { | ||
if (isEqual(thisOp.insert, otherOp.insert)) { | ||
retDelta.retain( | ||
@@ -338,3 +338,3 @@ opLength, | ||
) => boolean | void, | ||
newline: string = '\n', | ||
newline = '\n', | ||
): void { | ||
@@ -382,3 +382,3 @@ const iter = Op.iterator(this.ops); | ||
const slice = base.slice(baseIndex, baseIndex + length); | ||
slice.forEach(baseOp => { | ||
slice.forEach((baseOp) => { | ||
if (op.delete) { | ||
@@ -402,3 +402,3 @@ inverted.push(baseOp); | ||
transform(other: Delta, priority?: boolean): Delta; | ||
transform(arg: number | Delta, priority: boolean = false): typeof arg { | ||
transform(arg: number | Delta, priority = false): typeof arg { | ||
priority = !!priority; | ||
@@ -445,3 +445,3 @@ if (typeof arg === 'number') { | ||
transformPosition(index: number, priority: boolean = false): number { | ||
transformPosition(index: number, priority = false): number { | ||
priority = !!priority; | ||
@@ -448,0 +448,0 @@ const thisIter = Op.iterator(this.ops); |
@@ -14,3 +14,3 @@ import AttributeMap from './AttributeMap'; | ||
namespace Op { | ||
export function iterator(ops: Op[]) { | ||
export function iterator(ops: Op[]): Iterator { | ||
return new Iterator(ops); | ||
@@ -17,0 +17,0 @@ } |
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
86424
1345
12
+ Addedlodash.clonedeep@^4.5.0
+ Addedlodash.isequal@^4.5.0
+ Addedlodash.clonedeep@4.5.0(transitive)
+ Addedlodash.isequal@4.5.0(transitive)
- Removeddeep-equal@^1.0.1
- Removedextend@^3.0.2
- Removedcall-bind@1.0.7(transitive)
- Removeddeep-equal@1.1.2(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedextend@3.0.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedfunctions-have-names@1.2.3(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedis-arguments@1.1.1(transitive)
- Removedis-date-object@1.0.5(transitive)
- Removedis-regex@1.1.4(transitive)
- Removedobject-is@1.1.6(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedregexp.prototype.flags@1.5.3(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedset-function-name@2.0.2(transitive)