react-diff-sync
Advanced tools
+27
-2
@@ -66,2 +66,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
| var Operations = { | ||
| Add: '+', | ||
| Remove: '-', | ||
| InsertElement: '+e', | ||
| SpliceElement: '-e' | ||
| }; | ||
| class Revision { | ||
@@ -75,3 +82,3 @@ constructor(data) { | ||
| this.history.push({ | ||
| op: '+', | ||
| op: Operations.Add, | ||
| key, | ||
@@ -84,3 +91,3 @@ value | ||
| this.history.push({ | ||
| op: '-', | ||
| op: Operations.Remove, | ||
| key | ||
@@ -90,2 +97,20 @@ }); | ||
| insertElement(key, index, value) { | ||
| this.history.push({ | ||
| op: Operations.InsertElement, | ||
| key, | ||
| index, | ||
| value | ||
| }); | ||
| } | ||
| spliceElement(key, index, count) { | ||
| this.history.push({ | ||
| op: Operations.SpliceElement, | ||
| key, | ||
| index, | ||
| count: count || 1 | ||
| }); | ||
| } | ||
| } | ||
@@ -92,0 +117,0 @@ |
+27
-2
@@ -70,2 +70,9 @@ 'use strict'; | ||
| var Operations = { | ||
| Add: '+', | ||
| Remove: '-', | ||
| InsertElement: '+e', | ||
| SpliceElement: '-e' | ||
| }; | ||
| class Revision { | ||
@@ -79,3 +86,3 @@ constructor(data) { | ||
| this.history.push({ | ||
| op: '+', | ||
| op: Operations.Add, | ||
| key, | ||
@@ -88,3 +95,3 @@ value | ||
| this.history.push({ | ||
| op: '-', | ||
| op: Operations.Remove, | ||
| key | ||
@@ -94,2 +101,20 @@ }); | ||
| insertElement(key, index, value) { | ||
| this.history.push({ | ||
| op: Operations.InsertElement, | ||
| key, | ||
| index, | ||
| value | ||
| }); | ||
| } | ||
| spliceElement(key, index, count) { | ||
| this.history.push({ | ||
| op: Operations.SpliceElement, | ||
| key, | ||
| index, | ||
| count: count || 1 | ||
| }); | ||
| } | ||
| } | ||
@@ -96,0 +121,0 @@ |
+1
-1
| { | ||
| "name": "react-diff-sync", | ||
| "version": "1.0.2", | ||
| "version": "1.0.3", | ||
| "description": "The diff versioning library for React Project", | ||
@@ -5,0 +5,0 @@ "author": "samick17", |
12069
7.56%347
14.52%