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

quill-delta

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quill-delta - npm Package Compare versions

Comparing version 3.5.0 to 3.6.0

23

lib/delta.js

@@ -85,2 +85,10 @@ var diff = require('fast-diff');

Delta.prototype.chop = function () {
var lastOp = this.ops[this.ops.length - 1];
if (lastOp && lastOp.retain && !lastOp.attributes) {
this.ops.pop();
}
return this;
};
Delta.prototype.filter = function (predicate) {

@@ -111,8 +119,11 @@ return this.ops.filter(predicate);

Delta.prototype.chop = function () {
var lastOp = this.ops[this.ops.length - 1];
if (lastOp && lastOp.retain && !lastOp.attributes) {
this.ops.pop();
}
return this;
Delta.prototype.changeLength = function () {
return this.reduce((length, elem) => {
if (elem.insert) {
return length + op.length(elem);
} else if (elem.delete) {
return length - elem.delete;
}
return length;
}, 0);
};

@@ -119,0 +130,0 @@

{
"name": "quill-delta",
"version": "3.5.0",
"version": "3.6.0",
"description": "Format for representing rich text documents and changes.",

@@ -10,9 +10,9 @@ "author": "Jason Chen <jhchen7@gmail.com>",

"deep-equal": "^1.0.1",
"extend": "^3.0.0",
"extend": "^3.0.1",
"fast-diff": "1.1.1"
},
"devDependencies": {
"coveralls": "^2.11.14",
"coveralls": "^2.13.1",
"istanbul": "~0.4.5",
"jasmine": "^2.5.2"
"jasmine": "^2.7.0"
},

@@ -19,0 +19,0 @@ "engines": {

@@ -56,5 +56,5 @@ # Delta [![Build Status](https://travis-ci.org/quilljs/delta.svg?branch=master)](http://travis-ci.org/quilljs/delta) [![Coverage Status](https://img.shields.io/coveralls/quilljs/delta.svg)](https://coveralls.io/r/quilljs/delta)

- [insert](#insert-operation)
- [delete](#delete-operation)
- [retain](#retain-operation)
- [`insert`](#insert-operation)
- [`delete`](#delete-operation)
- [`retain`](#retain-operation)

@@ -341,3 +341,3 @@ #### Construction

delta.eachline(function(line, attributes, i) {
delta.eachLine(function(line, attributes, i) {
console.log(line, attributes, i);

@@ -344,0 +344,0 @@ // Can return false to exit loop early

@@ -154,2 +154,9 @@ var Delta = require('../../lib/delta');

describe('changeLength()', function () {
it('mixed', function () {
var delta = new Delta().insert('AB', { bold: true }).retain(2, { bold: null }).delete(1);
expect(delta.changeLength()).toEqual(1);
});
});
describe('slice()', function () {

@@ -156,0 +163,0 @@ it('start', function () {

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