react-diff-sync
Advanced tools
+178
| function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
| try { | ||
| var info = gen[key](arg); | ||
| var value = info.value; | ||
| } catch (error) { | ||
| reject(error); | ||
| return; | ||
| } | ||
| if (info.done) { | ||
| resolve(value); | ||
| } else { | ||
| Promise.resolve(value).then(_next, _throw); | ||
| } | ||
| } | ||
| function _asyncToGenerator(fn) { | ||
| return function () { | ||
| var self = this, | ||
| args = arguments; | ||
| return new Promise(function (resolve, reject) { | ||
| var gen = fn.apply(self, args); | ||
| function _next(value) { | ||
| asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
| } | ||
| function _throw(err) { | ||
| asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
| } | ||
| _next(undefined); | ||
| }); | ||
| }; | ||
| } | ||
| class AbstractRepo { | ||
| submit(revs) { | ||
| return _asyncToGenerator(function* () {})(); | ||
| } | ||
| pull(revId) { | ||
| return _asyncToGenerator(function* () {})(); | ||
| } | ||
| } | ||
| class IdGenerator { | ||
| constructor() { | ||
| this.prefix = 'o'; | ||
| this.index = 1; | ||
| } | ||
| genId() { | ||
| var index = this.index; | ||
| this.index++; | ||
| return "".concat(this.prefix).concat(index); | ||
| } | ||
| } | ||
| class Revision { | ||
| constructor(data) { | ||
| this.history = []; | ||
| Object.assign(this, data); | ||
| } | ||
| add(key, value) { | ||
| this.history.push({ | ||
| op: '+', | ||
| key, | ||
| value | ||
| }); | ||
| } | ||
| remove(key) { | ||
| this.history.push({ | ||
| op: '-', | ||
| key | ||
| }); | ||
| } | ||
| } | ||
| class MockRepo extends AbstractRepo { | ||
| constructor() { | ||
| super(...arguments); | ||
| this.revs = []; | ||
| } | ||
| submit(revs) { | ||
| var _this = this; | ||
| return _asyncToGenerator(function* () { | ||
| _this.revs.push.apply(_this.revs, revs); | ||
| })(); | ||
| } | ||
| pull(revId) { | ||
| var _this2 = this; | ||
| return _asyncToGenerator(function* () { | ||
| if (revId) { | ||
| var index = _this2.revs.findIndex(e => { | ||
| return e.id === revId; | ||
| }); | ||
| return _this2.revs.slice(index + 1); | ||
| } else { | ||
| return _this2.revs; | ||
| } | ||
| })(); | ||
| } | ||
| getRevisions() { | ||
| return this.revs; | ||
| } | ||
| } | ||
| var Repo = { | ||
| AbstractRepo, | ||
| createMockRepo: function createMockRepo() { | ||
| return new MockRepo(); | ||
| } | ||
| }; | ||
| class DiffSync { | ||
| constructor() { | ||
| this.latestRevisionId = ''; | ||
| this.revIdGenerator = new IdGenerator(); | ||
| this.repo = Repo.createMockRepo(); | ||
| } | ||
| setRepo(repo) { | ||
| this.repo = repo; | ||
| } | ||
| createRevision() { | ||
| var newId = this.revIdGenerator.genId(); | ||
| return new Revision({ | ||
| id: newId | ||
| }); | ||
| } | ||
| submit(revs) { | ||
| var _this = this; | ||
| return _asyncToGenerator(function* () { | ||
| yield _this.repo.submit(revs); | ||
| })(); | ||
| } | ||
| pull(revId) { | ||
| var _this2 = this; | ||
| return _asyncToGenerator(function* () { | ||
| return yield _this2.repo.pull(revId); | ||
| })(); | ||
| } | ||
| update() { | ||
| var _this3 = this; | ||
| return _asyncToGenerator(function* () { | ||
| var changedRevs = yield _this3.pull(_this3.latestRevisionId); | ||
| if (changedRevs.length > 0) { | ||
| _this3.latestRevisionId = changedRevs[changedRevs.length - 1].id; | ||
| } | ||
| return changedRevs; | ||
| })(); | ||
| } | ||
| } | ||
| export { AbstractRepo, DiffSync }; |
+183
| 'use strict'; | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
| try { | ||
| var info = gen[key](arg); | ||
| var value = info.value; | ||
| } catch (error) { | ||
| reject(error); | ||
| return; | ||
| } | ||
| if (info.done) { | ||
| resolve(value); | ||
| } else { | ||
| Promise.resolve(value).then(_next, _throw); | ||
| } | ||
| } | ||
| function _asyncToGenerator(fn) { | ||
| return function () { | ||
| var self = this, | ||
| args = arguments; | ||
| return new Promise(function (resolve, reject) { | ||
| var gen = fn.apply(self, args); | ||
| function _next(value) { | ||
| asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
| } | ||
| function _throw(err) { | ||
| asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
| } | ||
| _next(undefined); | ||
| }); | ||
| }; | ||
| } | ||
| class AbstractRepo { | ||
| submit(revs) { | ||
| return _asyncToGenerator(function* () {})(); | ||
| } | ||
| pull(revId) { | ||
| return _asyncToGenerator(function* () {})(); | ||
| } | ||
| } | ||
| class IdGenerator { | ||
| constructor() { | ||
| this.prefix = 'o'; | ||
| this.index = 1; | ||
| } | ||
| genId() { | ||
| var index = this.index; | ||
| this.index++; | ||
| return "".concat(this.prefix).concat(index); | ||
| } | ||
| } | ||
| class Revision { | ||
| constructor(data) { | ||
| this.history = []; | ||
| Object.assign(this, data); | ||
| } | ||
| add(key, value) { | ||
| this.history.push({ | ||
| op: '+', | ||
| key, | ||
| value | ||
| }); | ||
| } | ||
| remove(key) { | ||
| this.history.push({ | ||
| op: '-', | ||
| key | ||
| }); | ||
| } | ||
| } | ||
| class MockRepo extends AbstractRepo { | ||
| constructor() { | ||
| super(...arguments); | ||
| this.revs = []; | ||
| } | ||
| submit(revs) { | ||
| var _this = this; | ||
| return _asyncToGenerator(function* () { | ||
| _this.revs.push.apply(_this.revs, revs); | ||
| })(); | ||
| } | ||
| pull(revId) { | ||
| var _this2 = this; | ||
| return _asyncToGenerator(function* () { | ||
| if (revId) { | ||
| var index = _this2.revs.findIndex(e => { | ||
| return e.id === revId; | ||
| }); | ||
| return _this2.revs.slice(index + 1); | ||
| } else { | ||
| return _this2.revs; | ||
| } | ||
| })(); | ||
| } | ||
| getRevisions() { | ||
| return this.revs; | ||
| } | ||
| } | ||
| var Repo = { | ||
| AbstractRepo, | ||
| createMockRepo: function createMockRepo() { | ||
| return new MockRepo(); | ||
| } | ||
| }; | ||
| class DiffSync { | ||
| constructor() { | ||
| this.latestRevisionId = ''; | ||
| this.revIdGenerator = new IdGenerator(); | ||
| this.repo = Repo.createMockRepo(); | ||
| } | ||
| setRepo(repo) { | ||
| this.repo = repo; | ||
| } | ||
| createRevision() { | ||
| var newId = this.revIdGenerator.genId(); | ||
| return new Revision({ | ||
| id: newId | ||
| }); | ||
| } | ||
| submit(revs) { | ||
| var _this = this; | ||
| return _asyncToGenerator(function* () { | ||
| yield _this.repo.submit(revs); | ||
| })(); | ||
| } | ||
| pull(revId) { | ||
| var _this2 = this; | ||
| return _asyncToGenerator(function* () { | ||
| return yield _this2.repo.pull(revId); | ||
| })(); | ||
| } | ||
| update() { | ||
| var _this3 = this; | ||
| return _asyncToGenerator(function* () { | ||
| var changedRevs = yield _this3.pull(_this3.latestRevisionId); | ||
| if (changedRevs.length > 0) { | ||
| _this3.latestRevisionId = changedRevs[changedRevs.length - 1].id; | ||
| } | ||
| return changedRevs; | ||
| })(); | ||
| } | ||
| } | ||
| exports.AbstractRepo = AbstractRepo; | ||
| exports.DiffSync = DiffSync; |
+0
-0
@@ -0,0 +0,0 @@ { |
+0
-0
@@ -0,0 +0,0 @@ { |
+0
-0
@@ -0,0 +0,0 @@ MIT License |
+2
-2
| { | ||
| "name": "react-diff-sync", | ||
| "version": "1.0.0", | ||
| "description": "The multiple tabs application for React Project", | ||
| "version": "1.0.1", | ||
| "description": "The diff versioning library for React Project", | ||
| "author": "samick17", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
+5
-1
@@ -5,3 +5,3 @@ # react-diff-sync | ||
| [](https://www.npmjs.com/package/reacted) [](https://standardjs.com) | ||
| [](https://www.npmjs.com/package/react-diff-sync) [](https://standardjs.com) | ||
@@ -21,2 +21,6 @@ ## Support the project | ||
| ```js | ||
| import { DiffSync, AbstractRepo } from 'react-diff-sync'; | ||
| ``` | ||
| ## Import specified module | ||
@@ -23,0 +27,0 @@ |
-178
| function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
| try { | ||
| var info = gen[key](arg); | ||
| var value = info.value; | ||
| } catch (error) { | ||
| reject(error); | ||
| return; | ||
| } | ||
| if (info.done) { | ||
| resolve(value); | ||
| } else { | ||
| Promise.resolve(value).then(_next, _throw); | ||
| } | ||
| } | ||
| function _asyncToGenerator(fn) { | ||
| return function () { | ||
| var self = this, | ||
| args = arguments; | ||
| return new Promise(function (resolve, reject) { | ||
| var gen = fn.apply(self, args); | ||
| function _next(value) { | ||
| asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
| } | ||
| function _throw(err) { | ||
| asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
| } | ||
| _next(undefined); | ||
| }); | ||
| }; | ||
| } | ||
| class AbstractRepo { | ||
| submit(revs) { | ||
| return _asyncToGenerator(function* () {})(); | ||
| } | ||
| pull(revId) { | ||
| return _asyncToGenerator(function* () {})(); | ||
| } | ||
| } | ||
| class IdGenerator { | ||
| constructor() { | ||
| this.prefix = 'o'; | ||
| this.index = 1; | ||
| } | ||
| genId() { | ||
| var index = this.index; | ||
| this.index++; | ||
| return "".concat(this.prefix).concat(index); | ||
| } | ||
| } | ||
| class Revision { | ||
| constructor(data) { | ||
| this.history = []; | ||
| Object.assign(this, data); | ||
| } | ||
| add(key, value) { | ||
| this.history.push({ | ||
| op: '+', | ||
| key, | ||
| value | ||
| }); | ||
| } | ||
| remove(key) { | ||
| this.history.push({ | ||
| op: '-', | ||
| key | ||
| }); | ||
| } | ||
| } | ||
| class MockRepo extends AbstractRepo { | ||
| constructor() { | ||
| super(...arguments); | ||
| this.revs = []; | ||
| } | ||
| submit(revs) { | ||
| var _this = this; | ||
| return _asyncToGenerator(function* () { | ||
| _this.revs.push.apply(_this.revs, revs); | ||
| })(); | ||
| } | ||
| pull(revId) { | ||
| var _this2 = this; | ||
| return _asyncToGenerator(function* () { | ||
| if (revId) { | ||
| var index = _this2.revs.findIndex(e => { | ||
| return e.id === revId; | ||
| }); | ||
| return _this2.revs.slice(index + 1); | ||
| } else { | ||
| return _this2.revs; | ||
| } | ||
| })(); | ||
| } | ||
| getRevisions() { | ||
| return this.revs; | ||
| } | ||
| } | ||
| var Repo = { | ||
| AbstractRepo, | ||
| createMockRepo: function createMockRepo() { | ||
| return new MockRepo(); | ||
| } | ||
| }; | ||
| class DiffSync { | ||
| constructor() { | ||
| this.latestRevisionId = ''; | ||
| this.revIdGenerator = new IdGenerator(); | ||
| this.repo = Repo.createMockRepo(); | ||
| } | ||
| setRepo(repo) { | ||
| this.repo = repo; | ||
| } | ||
| createRevision() { | ||
| var newId = this.revIdGenerator.genId(); | ||
| return new Revision({ | ||
| id: newId | ||
| }); | ||
| } | ||
| submit(revs) { | ||
| var _this = this; | ||
| return _asyncToGenerator(function* () { | ||
| yield _this.repo.submit(revs); | ||
| })(); | ||
| } | ||
| pull(revId) { | ||
| var _this2 = this; | ||
| return _asyncToGenerator(function* () { | ||
| return yield _this2.repo.pull(revId); | ||
| })(); | ||
| } | ||
| update() { | ||
| var _this3 = this; | ||
| return _asyncToGenerator(function* () { | ||
| var changedRevs = yield _this3.pull(_this3.latestRevisionId); | ||
| if (changedRevs.length > 0) { | ||
| _this3.latestRevisionId = changedRevs[changedRevs.length - 1].id; | ||
| } | ||
| return changedRevs; | ||
| })(); | ||
| } | ||
| } | ||
| export { AbstractRepo, DiffSync }; |
-183
| 'use strict'; | ||
| Object.defineProperty(exports, '__esModule', { value: true }); | ||
| function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
| try { | ||
| var info = gen[key](arg); | ||
| var value = info.value; | ||
| } catch (error) { | ||
| reject(error); | ||
| return; | ||
| } | ||
| if (info.done) { | ||
| resolve(value); | ||
| } else { | ||
| Promise.resolve(value).then(_next, _throw); | ||
| } | ||
| } | ||
| function _asyncToGenerator(fn) { | ||
| return function () { | ||
| var self = this, | ||
| args = arguments; | ||
| return new Promise(function (resolve, reject) { | ||
| var gen = fn.apply(self, args); | ||
| function _next(value) { | ||
| asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); | ||
| } | ||
| function _throw(err) { | ||
| asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); | ||
| } | ||
| _next(undefined); | ||
| }); | ||
| }; | ||
| } | ||
| class AbstractRepo { | ||
| submit(revs) { | ||
| return _asyncToGenerator(function* () {})(); | ||
| } | ||
| pull(revId) { | ||
| return _asyncToGenerator(function* () {})(); | ||
| } | ||
| } | ||
| class IdGenerator { | ||
| constructor() { | ||
| this.prefix = 'o'; | ||
| this.index = 1; | ||
| } | ||
| genId() { | ||
| var index = this.index; | ||
| this.index++; | ||
| return "".concat(this.prefix).concat(index); | ||
| } | ||
| } | ||
| class Revision { | ||
| constructor(data) { | ||
| this.history = []; | ||
| Object.assign(this, data); | ||
| } | ||
| add(key, value) { | ||
| this.history.push({ | ||
| op: '+', | ||
| key, | ||
| value | ||
| }); | ||
| } | ||
| remove(key) { | ||
| this.history.push({ | ||
| op: '-', | ||
| key | ||
| }); | ||
| } | ||
| } | ||
| class MockRepo extends AbstractRepo { | ||
| constructor() { | ||
| super(...arguments); | ||
| this.revs = []; | ||
| } | ||
| submit(revs) { | ||
| var _this = this; | ||
| return _asyncToGenerator(function* () { | ||
| _this.revs.push.apply(_this.revs, revs); | ||
| })(); | ||
| } | ||
| pull(revId) { | ||
| var _this2 = this; | ||
| return _asyncToGenerator(function* () { | ||
| if (revId) { | ||
| var index = _this2.revs.findIndex(e => { | ||
| return e.id === revId; | ||
| }); | ||
| return _this2.revs.slice(index + 1); | ||
| } else { | ||
| return _this2.revs; | ||
| } | ||
| })(); | ||
| } | ||
| getRevisions() { | ||
| return this.revs; | ||
| } | ||
| } | ||
| var Repo = { | ||
| AbstractRepo, | ||
| createMockRepo: function createMockRepo() { | ||
| return new MockRepo(); | ||
| } | ||
| }; | ||
| class DiffSync { | ||
| constructor() { | ||
| this.latestRevisionId = ''; | ||
| this.revIdGenerator = new IdGenerator(); | ||
| this.repo = Repo.createMockRepo(); | ||
| } | ||
| setRepo(repo) { | ||
| this.repo = repo; | ||
| } | ||
| createRevision() { | ||
| var newId = this.revIdGenerator.genId(); | ||
| return new Revision({ | ||
| id: newId | ||
| }); | ||
| } | ||
| submit(revs) { | ||
| var _this = this; | ||
| return _asyncToGenerator(function* () { | ||
| yield _this.repo.submit(revs); | ||
| })(); | ||
| } | ||
| pull(revId) { | ||
| var _this2 = this; | ||
| return _asyncToGenerator(function* () { | ||
| return yield _this2.repo.pull(revId); | ||
| })(); | ||
| } | ||
| update() { | ||
| var _this3 = this; | ||
| return _asyncToGenerator(function* () { | ||
| var changedRevs = yield _this3.pull(_this3.latestRevisionId); | ||
| if (changedRevs.length > 0) { | ||
| _this3.latestRevisionId = changedRevs[changedRevs.length - 1].id; | ||
| } | ||
| return changedRevs; | ||
| })(); | ||
| } | ||
| } | ||
| exports.AbstractRepo = AbstractRepo; | ||
| exports.DiffSync = DiffSync; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10959
2.23%34
13.33%1
Infinity%