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

rich-text

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rich-text - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

52

lib/type.js

@@ -7,33 +7,35 @@ var Delta = require('./delta');

Delta: Delta,
name: 'rich-text',
uri: 'http://sharejs.org/types/rich-text/v1',
type: {
name: 'rich-text',
uri: 'http://sharejs.org/types/rich-text/v1',
create: function (initial) {
return new Delta(initial);
},
create: function (initial) {
return new Delta(initial);
},
apply: function (snapshot, delta) {
snapshot = new Delta(snapshot);
delta = new Delta(delta);
return snapshot.compose(delta);
},
apply: function (snapshot, delta) {
snapshot = new Delta(snapshot);
delta = new Delta(delta);
return snapshot.compose(delta);
},
compose: function (delta1, delta2) {
delta1 = new Delta(delta1);
delta2 = new Delta(delta2);
return delta1.compose(delta2);
},
compose: function (delta1, delta2) {
delta1 = new Delta(delta1);
delta2 = new Delta(delta2);
return delta1.compose(delta2);
},
diff: function (delta1, delta2) {
delta1 = new Delta(delta1);
delta2 = new Delta(delta2);
return delta1.diff(delta2);
},
diff: function (delta1, delta2) {
delta1 = new Delta(delta1);
delta2 = new Delta(delta2);
return delta1.diff(delta2);
},
transform: function (delta1, delta2, side) {
delta1 = new Delta(delta1);
delta2 = new Delta(delta2);
// Fuzzer specs is in opposite order of delta interface
return delta2.transform(delta1, side === 'left');
transform: function (delta1, delta2, side) {
delta1 = new Delta(delta1);
delta2 = new Delta(delta2);
// Fuzzer specs is in opposite order of delta interface
return delta2.transform(delta1, side === 'left');
}
}
};
{
"name": "rich-text",
"version": "1.0.3",
"version": "1.1.0",
"description": "Format for representing rich text documents and changes.",

@@ -12,8 +12,8 @@ "author": "Jason Chen <jhchen7@gmail.com>",

"devDependencies": {
"chai": "~1.9.1",
"chai": "~2.1.1",
"coveralls": "~2.11.1",
"grunt": "~0.4.5",
"istanbul": "~0.3.0",
"lodash": "~2.4.1",
"mocha": "~1.21.4",
"lodash": "~3.5.0",
"mocha": "~2.2.1",
"ot-fuzzer": "~1.0.0"

@@ -20,0 +20,0 @@ },

@@ -316,2 +316,4 @@ # Rich Text [![Build Status](https://travis-ci.org/ottypes/rich-text.svg?branch=master)](http://travis-ci.org/ottypes/rich-text) [![Coverage Status](https://img.shields.io/coveralls/ottypes/rich-text.svg)](https://coveralls.io/r/ottypes/rich-text)

---
### transform()

@@ -374,2 +376,4 @@

The following methods are supported only for Deltas that represent a document (i.e. they only contain inserts). There are no guarantees on the behavior on non-document Deltas.
---

@@ -401,1 +405,22 @@

```
---
### length()
Calculates the length of the document.
#### Methods
- `length()`
#### Returns
- `Number` - length of the document
#### Example
```js
var delta = new Delta().insert('Hello');
var length = delta.length();
```
var _ = require('lodash');
var fuzzer = require('ot-fuzzer');
var richType = require('../lib/type');
var Delta = richType.Delta;
var richText = require('../lib/type');
var Delta = richText.Delta;

@@ -139,2 +139,2 @@ var FORMATS = {

fuzzer(richType, generateRandomOp, 100);
fuzzer(richText.type, generateRandomOp, 100);
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