Socket
Socket
Sign inDemoInstall

ancient-cursor

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ancient-cursor - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

.vscode/launch.json

43

lib/bundle.d.ts

@@ -1,2 +0,2 @@

interface IBundle {
export interface IBundle {
type: string;

@@ -6,4 +6,3 @@ path: TBundlePaths;

}
interface IBundleChanges {
oldValue: any;
export interface IBundleChanges {
newValue: any;

@@ -14,3 +13,3 @@ bundlePath: string[];

}
interface IBundleParser {
export interface IBundleParser {
(container: {

@@ -20,20 +19,30 @@ data: any;

}
interface IBundleParsers {
export interface IBundleParsers {
[name: string]: IBundleParser;
}
interface IBundleValue extends IBundle {
export interface IBundleValue extends IBundle {
value: any;
}
declare type TBundlePath = string;
declare type TBundleSelector = any;
declare type TBundlePathsStep = TBundlePath | TBundleSelector;
declare type TBundlePaths = string | TBundlePathsStep[];
declare function toPath(data: any, paths: TBundlePaths): TBundlePath;
declare function get(data: any, paths: TBundlePaths): any;
declare function getByPath(data: any, path: any): any;
declare function prepare(container: any, bundle: any): {
export interface IBundleSelector extends IBundle {
selector: TBundleSelector;
}
export interface IBundleSplice extends IBundle {
start: number;
deleteCount: number;
values: any[];
}
export interface IBundleMove extends IBundle {
from: number;
to: number;
}
export declare type TBundlePath = string;
export declare type TBundleSelector = any;
export declare type TBundlePathsStep = TBundlePath | TBundleSelector;
export declare type TBundlePaths = string | TBundlePathsStep[];
export declare function toPath(data: any, paths: TBundlePaths): TBundlePath;
export declare function get(data: any, paths: TBundlePaths): any;
export declare function getByPath(data: any, path: any): any;
export declare function prepare(container: any, bundle: any): {
bundlePath: string[];
oldValue: any;
};
declare const bundleParsers: IBundleParsers;
export { IBundleParser, IBundleParsers, IBundleChanges, IBundle, IBundleValue, TBundlePath, TBundleSelector, TBundlePathsStep, TBundlePaths, bundleParsers, get, getByPath, toPath, prepare };
export declare const bundleParsers: IBundleParsers;

@@ -37,9 +37,8 @@ "use strict";

const bundlePath = _.toPath(toPath(container.data, bundle.path));
const oldValue = _.clone(get(container.data, bundlePath));
return { oldValue, bundlePath };
return { bundlePath };
}
exports.prepare = prepare;
const bundleParsers = {
exports.bundleParsers = {
set(container, bundle) {
const { oldValue, bundlePath } = prepare(container, bundle);
const { bundlePath } = prepare(container, bundle);
if (!bundlePath.length) {

@@ -52,6 +51,6 @@ container.data = bundle.value;

const newValue = get(container.data, bundlePath);
return { oldValue, newValue, bundlePath, bundle, data: container.data };
return { newValue, bundlePath, bundle, data: container.data };
},
extend(container, bundle) {
const { oldValue, bundlePath } = prepare(container, bundle);
const { bundlePath } = prepare(container, bundle);
if (!bundlePath.length) {

@@ -64,6 +63,6 @@ _.extend(container.data, bundle.value);

const newValue = get(container.data, bundlePath);
return { oldValue, newValue, bundlePath, bundle, data: container.data };
return { newValue, bundlePath, bundle, data: container.data };
},
unset(container, bundle) {
const { oldValue, bundlePath } = prepare(container, bundle);
const { bundlePath } = prepare(container, bundle);
if (!bundlePath.length) {

@@ -77,6 +76,6 @@ container.data = undefined;

const newValue = get(container.data, bundlePath);
return { oldValue, newValue, bundlePath, bundle, data: container.data };
return { newValue, bundlePath, bundle, data: container.data };
},
splice(container, bundle) {
const { oldValue, bundlePath } = prepare(container, bundle);
const { bundlePath } = prepare(container, bundle);
const value = get(container.data, bundlePath);

@@ -88,6 +87,6 @@ if (!_.isArray(value)) {

const newValue = value;
return { oldValue, newValue, bundlePath, bundle, data: container.data };
return { newValue, bundlePath, bundle, data: container.data };
},
remove(container, bundle) {
const { oldValue, bundlePath } = prepare(container, bundle);
const { bundlePath } = prepare(container, bundle);
const value = get(container.data, bundlePath);

@@ -99,6 +98,6 @@ if (!_.isArray(value)) {

const newValue = value;
return { oldValue, newValue, bundlePath, bundle, data: container.data };
return { newValue, bundlePath, bundle, data: container.data };
},
push(container, bundle) {
const { oldValue, bundlePath } = prepare(container, bundle);
const { bundlePath } = prepare(container, bundle);
const value = get(container.data, bundlePath);

@@ -110,6 +109,6 @@ if (!_.isArray(value)) {

const newValue = value;
return { oldValue, newValue, bundlePath, bundle, data: container.data };
return { newValue, bundlePath, bundle, data: container.data };
},
move(container, bundle) {
const { oldValue, bundlePath } = prepare(container, bundle);
const { bundlePath } = prepare(container, bundle);
const value = get(container.data, bundlePath);

@@ -121,6 +120,5 @@ if (!_.isArray(value)) {

const newValue = value;
return { oldValue, newValue, bundlePath, bundle, data: container.data };
return { newValue, bundlePath, bundle, data: container.data };
},
};
exports.bundleParsers = bundleParsers;
//# sourceMappingURL=bundle.js.map
import { TClass, IInstance } from 'ancient-mixins/lib/mixins';
import { INode, INodeEventsList } from 'ancient-mixins/lib/node';
import { TManager } from 'ancient-mixins/lib/manager';
import { IBundle, IBundleChanges, TBundlePaths } from './bundle';
declare type TCursor = ICursor<ICursorEventsList>;
interface ICursorEventChangedData {
export declare type TCursor = ICursor<ICursorEventsList>;
export interface ICursorEventChangedData {
data: any;
oldValue: any;
newValue: any;
bundlePath: string[];
bundle: IBundle;
watch: ICursorWatch;
bundleChanges: IBundleChanges;
cursor: TCursor;
}
interface ICursorEventExecData {
export interface ICursorEventExecData {
cursor: TCursor;

@@ -20,7 +20,5 @@ oldQuery: any;

}
interface ICursorWatchData {
export interface ICursorWatchData {
data: any;
oldValue: any;
newValue: any;
isClone: boolean;
bundlePath: string[];

@@ -32,13 +30,13 @@ watchPath: string[];

}
interface ICursorWatch {
export interface ICursorWatch {
(path: TBundlePaths, listener: (data: ICursorWatchData) => void): void;
}
interface ICursorEventListener {
export interface ICursorEventListener {
(data: ICursorEventChangedData): void;
}
interface ICursorEventsList extends INodeEventsList {
export interface ICursorEventsList extends INodeEventsList {
changed: ICursorEventChangedData;
exec: ICursorEventExecData;
}
interface ICursor<IEventsList extends ICursorEventsList> extends INode<IEventsList> {
export interface ICursor<IEventsList extends ICursorEventsList> extends INode<IEventsList> {
queryId: string;

@@ -52,7 +50,8 @@ query: any;

}
declare function watch({oldValue, newValue, bundlePath, data, bundle}: IBundleChanges, paths: TBundlePaths, listener: (data: ICursorWatchData) => void): void;
declare function mixin<T extends TClass<IInstance>>(superClass: T): any;
declare const MixedCursor: TClass<ICursor<ICursorEventsList>>;
declare class Cursor extends MixedCursor {
export declare function watch({newValue, bundlePath, data, bundle}: IBundleChanges, paths: TBundlePaths, listener: (data: ICursorWatchData) => void): void;
export declare function apply(cursor: any, bundle: any): void;
export declare function mixin<T extends TClass<IInstance>>(superClass: T): any;
export declare const MixedCursor: TClass<ICursor<ICursorEventsList>>;
export declare class Cursor extends MixedCursor {
}
export { mixin as default, mixin, MixedCursor, Cursor, ICursor, ICursorEventChangedData, ICursorEventExecData, ICursorWatchData, ICursorWatch, ICursorEventListener, ICursorEventsList, watch, TCursor };
export declare function spray(path: TBundlePaths, manager: TManager, cursor?: TClass<TCursor>): ((data: ICursorEventChangedData) => void);

@@ -6,3 +6,3 @@ "use strict";

const bundle_1 = require("./bundle");
function watch({ oldValue, newValue, bundlePath, data, bundle }, paths, listener) {
function watch({ newValue, bundlePath, data, bundle }, paths, listener) {
const watchPath = _.toPath(bundle_1.toPath(data, paths));

@@ -13,5 +13,3 @@ const localWatchPath = watchPath.slice(bundlePath.length);

const value = bundle_1.get(data, paths);
let localOldValue;
let localNewValue;
let isClone;
if (leastPathLength) {

@@ -23,14 +21,9 @@ if (!_.isEqual(watchPath.slice(0, leastPathLength), bundlePath.slice(0, leastPathLength))) {

if (bundlePath.length <= watchPath.length) {
localOldValue = bundle_1.get(oldValue, localWatchPath);
localNewValue = value;
isClone = true;
}
else {
localOldValue = localNewValue = bundle_1.get(data, paths);
isClone = false;
localNewValue = bundle_1.get(data, paths);
}
listener({
bundlePath, watchPath, localBundlePath, localWatchPath, data, bundle,
isClone,
oldValue: localOldValue,
newValue: localNewValue,

@@ -42,16 +35,14 @@ });

const bundleChanges = cursor.parse(bundle);
const { oldValue, newValue, bundlePath, data } = bundleChanges;
const { newValue, bundlePath, data } = bundleChanges;
const eventData = {
data,
oldValue,
newValue,
bundlePath,
bundle,
bundleChanges,
cursor,
watch: (path, listener) => {
watch(bundleChanges, path, listener);
},
};
cursor.emit('changed', eventData);
}
exports.apply = apply;
function mixin(superClass) {

@@ -85,9 +76,41 @@ return class Cursor extends superClass {

}
exports.default = mixin;
exports.mixin = mixin;
const MixedCursor = mixin(node_1.Node);
exports.MixedCursor = MixedCursor;
class Cursor extends MixedCursor {
exports.MixedCursor = mixin(node_1.Node);
class Cursor extends exports.MixedCursor {
}
exports.Cursor = Cursor;
function spray(path, manager, cursor = Cursor) {
return (({ bundlePath, bundleChanges }) => {
watch(bundleChanges, path, ({ newValue, bundlePath, watchPath, localBundlePath, localWatchPath, }) => {
if (localBundlePath.length) {
const id = localBundlePath[0];
const childData = bundle_1.get(newValue, id);
if (childData) {
if (!manager.list.nodes[id])
manager.add(new cursor(id));
manager.list.nodes[id].exec(null, childData);
}
else {
if (manager.list.nodes[id])
manager.list.nodes[id].destroy();
}
}
else {
_.each(manager.list.nodes, (childCursor, id) => {
const childData = bundle_1.get(newValue, id);
if (!childData)
childCursor.destroy();
else
childCursor.exec(null, childData);
});
_.each(newValue, (childData, id) => {
if (!manager.list.nodes[id])
manager.add(new cursor(id));
manager.list.nodes[id].exec(null, bundle_1.get(newValue, id));
});
}
});
});
}
exports.spray = spray;
//# sourceMappingURL=cursor.js.map
import { TClass, IInstance } from 'ancient-mixins/lib/mixins';
import { ICursor, ICursorEventsList } from './cursor';
import { IBundle } from './bundle';
interface IStackableBundle extends IBundle {
export interface IStackableBundle extends IBundle {
indexInStack?: number;
}
interface IStackableCursor<IEventsList extends ICursorEventsList> extends ICursor<IEventsList> {
export interface IStackableCursor<IEventsList extends ICursorEventsList> extends ICursor<IEventsList> {
nextBundleIndex: number;

@@ -12,8 +12,8 @@ bundlesStack: {

};
exec(query: any, data?: any): this;
apply(bundle: IStackableBundle): this;
}
declare function mixin<T extends TClass<IInstance>>(superClass: T): any;
declare const MixedStackableCursor: TClass<IStackableCursor<ICursorEventsList>>;
declare class StackableCursor extends MixedStackableCursor {
export declare function mixin<T extends TClass<IInstance>>(superClass: T): any;
export declare const MixedStackableCursor: TClass<IStackableCursor<ICursorEventsList>>;
export declare class StackableCursor extends MixedStackableCursor {
}
export { mixin as default, mixin, MixedStackableCursor, StackableCursor, IStackableCursor, IStackableBundle };

@@ -12,2 +12,8 @@ "use strict";

}
exec(query, data) {
this.nextBundleIndex = 0;
this.bundlesStack = {};
super.exec(query, data);
return this;
}
apply(bundle) {

@@ -38,9 +44,7 @@ if (_.isNumber(bundle.indexInStack)) {

}
exports.default = mixin;
exports.mixin = mixin;
const MixedStackableCursor = mixin(cursor_1.Cursor);
exports.MixedStackableCursor = MixedStackableCursor;
class StackableCursor extends MixedStackableCursor {
exports.MixedStackableCursor = mixin(cursor_1.Cursor);
class StackableCursor extends exports.MixedStackableCursor {
}
exports.StackableCursor = StackableCursor;
//# sourceMappingURL=stackable-cursor.js.map
{
"name": "ancient-cursor",
"version": "0.2.8",
"version": "0.2.9",
"description": "Abstract container of data synchronization.",

@@ -17,17 +17,18 @@ "bugs": "https://github.com/AncientSouls/Cursor/issues",

"dependencies": {
"lodash": "^4.17.5",
"ancient-mixins": "^0.0.11"
"ancient-mixins": "^0.0.11",
"lodash": "^4.17.10"
},
"devDependencies": {
"@types/mocha": "^2.2.48",
"@types/node": "^9.4.7",
"@types/node": "^9.6.8",
"chai": "^4.1.2",
"mocha": "^5.0.4",
"mocha": "^5.1.1",
"np": "^2.20.1",
"source-map-support": "^0.5.3",
"source-map-support": "^0.5.5",
"ts-node": "^6.0.2",
"tslint": "^5.9.1",
"tslint-config-airbnb": "^5.7.0",
"tslint-config-airbnb": "^5.8.0",
"tslint-eslint-rules": "^5.1.0",
"typescript": "^2.7.2"
"typescript": "^2.8.3"
}
}

@@ -8,2 +8,127 @@ # Ancient Cursor

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c81b6e5866d14bfe98ceb5ff0c5554da)](https://www.codacy.com/app/ivansglazunov/Cursor?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=AncientSouls/Cursor&amp;utm_campaign=Badge_Grade)
[![Read the Docs](https://img.shields.io/readthedocs/pip.svg)](https://ancientsouls.github.io/)
[![Read the Docs](https://img.shields.io/readthedocs/pip.svg)](https://ancientsouls.github.io/)
## Install
```
npm i --save ancient-cursor
```
## About
In most popular realisations of pubsub next abstractions (query, content, transport, source, storage) are stirred or combined, what, for example, makes dependence from current environment or makes schemes for data required.
- `Query` may be in any form.
- No need for schemes in `content`. Use it as desired.
- Cursor knows nothing about `transport`. It have events with data, which should be tracked, and something will make decisions about transporting. (we recommend [ancient-channels](https://github.com/AncientSouls/Channels) and [ancient-peer](https://github.com/AncientSouls/Peer))
- No dependency from `source` of data. It may be database-client or query-lang executor (like GraphQL). (we recommend [ancient-asket](https://github.com/AncientSouls/Asket))
- Use any database as `storage`. (we recommend [ancient-tracker](https://github.com/AncientSouls/Tracker))
### Path
We use this term around all the package. It may be like this
- _.get path syntax: `'a[1].c'` or `['a', 1, 'c']`
- _.get + _.match syntax: `['a', { b:2 }, 'c']`.
## Bundle
"Box" for data-changings with functions and parsers to work with it.
### Example
```js
import {
bundleParsers,
} from 'ancient-cursor/lib/bundle';
const container = { data: { a:[{ b:3, c:4 }] } };
bundleParsers.extend(container, {
type: 'extend',
path: 'a.0',
value: { d: 6 },
});
container.data; // { a:[{ b:3, c:4, d:6 }] }
```
[More bundles](https://ancientsouls.github.io/modules/_ancient_cursor_src_lib_bundle_.html)
## Cursor
Simple capsule to actualize remote data. With `cursor.exec()` you can send query to remote data source.
All changes apply using bundles as external stand-alone instructions what and where to change, when called `cursor.apply ()` function. `cursor.apply()` emits 'changed' event, where you can use `watch()` to listen changes by specified path.
### Example
```js
import {
Cursor,
watch,
} from '../lib/cursor';
let changed = false;
let watched = false;
const cursor = new Cursor();
cursor.on('exec', ({ cursor }) => {
// Here is transportation logic and after executing cursor.query by remote data-source may be called cursor.apply();
cursor.apply({
type: 'set',
path: '',
value: { a: [{ b: { c: 'd' } }] },
});
});
cursor.exec('some query');
cursor.on('changed', ({ bundleChanges }) => {
changed = true;
watch(bundleChanges, 'b', () => {
watched = true;
});
});
cursor.data // { a: [{ b: { c: 'd' } }] }
cursor.apply({
type: 'set',
path: 'a.0',
value: { d: { e: 'f' } },
});
cursor.data // { a: [{ d: { e: 'f' } }] }
triggered; // true;
watched; // false
cursor.apply({
type: 'extend',
path: '',
value: { b: 123 },
});
cursor.data // { a: [{ d: { e: 'f' } }], b: 123 }
watched; // true
```
### Stackable-cursor
Extends `Cursor` with queue funcionality.
#### Example
```ts
import {
StackableCursor,
} from '../lib/stackable-cursor';
const cursor = new StackableCursor();
cursor.exec(undefined, { a: [{ b: { c: 123 } }] });
cursor.apply({ indexInStack: 2, type: 'extend', path: 'a.0.b', value: {d: 234} });
cursor.bundlesStack.length; // 1
cursor.nextBundleIndex; // 0
cursor.data; // { a: [{ b: { c: 123 } }] }
cursor.apply({ indexInStack: 0, type: 'set', path: 'a.0.b.c', value: 456 });
cursor.bundlesStack.length; // 1
cursor.nextBundleIndex; // 1
cursor.data; // { a: [{ b: { c: 456 } }] }
cursor.apply({ indexInStack: 1, type: 'set', path: 'a.0.b.c', value: 345 });
cursor.bundlesStack.length; // 0
cursor.nextBundleIndex; // 3
cursor.data; // { a: [{ b: { c: 345, d: 234 } }] }
```

@@ -25,5 +25,4 @@ "use strict";

cursor.exec(true, { a: [{ b: { c: 'd' } }] });
cursor.on('changed', ({ data, oldValue, newValue, bundlePath, bundle, watch, cursor, }) => {
cursor.on('changed', ({ data, newValue, bundlePath, bundle, bundleChanges, cursor, }) => {
chai_1.assert.deepEqual(data, { a: [{ b: { d: 'e' } }] });
chai_1.assert.deepEqual(oldValue, { c: 'd' });
chai_1.assert.deepEqual(newValue, { d: 'e' });

@@ -41,59 +40,43 @@ done();

cursor.exec(true, { a: [{ b: { c: 'd' } }] });
cursor.on('changed', ({ watch }) => {
cursor.on('changed', ({ bundleChanges }) => {
let counter = 0;
watch('', ({ isClone, oldValue, newValue }) => {
chai_1.assert.isFalse(isClone);
chai_1.assert.deepEqual(oldValue, { a: [{ d: { e: 'f' } }] });
cursor_1.watch(bundleChanges, '', ({ newValue }) => {
chai_1.assert.deepEqual(newValue, { a: [{ d: { e: 'f' } }] });
counter++;
});
watch('a', ({ isClone, oldValue, newValue }) => {
chai_1.assert.isFalse(isClone);
chai_1.assert.deepEqual(oldValue, [{ d: { e: 'f' } }]);
cursor_1.watch(bundleChanges, 'a', ({ newValue }) => {
chai_1.assert.deepEqual(newValue, [{ d: { e: 'f' } }]);
counter++;
});
watch('a.0', ({ isClone, oldValue, newValue }) => {
chai_1.assert.isTrue(isClone);
chai_1.assert.deepEqual(oldValue, { b: { c: 'd' } });
cursor_1.watch(bundleChanges, 'a.0', ({ newValue }) => {
chai_1.assert.deepEqual(newValue, { d: { e: 'f' } });
counter++;
});
watch(['a', {}, 'b'], ({ isClone, oldValue, newValue }) => {
chai_1.assert.isTrue(isClone);
chai_1.assert.deepEqual(oldValue, { c: 'd' });
cursor_1.watch(bundleChanges, ['a', {}, 'b'], ({ newValue }) => {
chai_1.assert.deepEqual(newValue, undefined);
counter++;
});
watch('a.0.b', ({ isClone, oldValue, newValue }) => {
chai_1.assert.isTrue(isClone);
chai_1.assert.deepEqual(oldValue, { c: 'd' });
cursor_1.watch(bundleChanges, 'a.0.b', ({ newValue }) => {
chai_1.assert.deepEqual(newValue, undefined);
counter++;
});
watch('a.0.b.c', ({ isClone, oldValue, newValue }) => {
chai_1.assert.isTrue(isClone);
chai_1.assert.deepEqual(oldValue, 'd');
cursor_1.watch(bundleChanges, 'a.0.b.c', ({ newValue }) => {
chai_1.assert.deepEqual(newValue, undefined);
counter++;
});
watch('a.0.d', ({ isClone, oldValue, newValue }) => {
chai_1.assert.isTrue(isClone);
chai_1.assert.deepEqual(oldValue, undefined);
cursor_1.watch(bundleChanges, 'a.0.d', ({ newValue }) => {
chai_1.assert.deepEqual(newValue, { e: 'f' });
counter++;
});
watch('a.0.d.e', ({ isClone, oldValue, newValue }) => {
chai_1.assert.isTrue(isClone);
chai_1.assert.deepEqual(oldValue, undefined);
cursor_1.watch(bundleChanges, 'a.0.d.e', ({ newValue }) => {
chai_1.assert.deepEqual(newValue, 'f');
counter++;
});
watch('x.y.z', ({ isClone, oldValue, newValue }) => {
cursor_1.watch(bundleChanges, 'x.y.z', ({ newValue }) => {
throw new Error('"x.y.z" path is not changed, wrong watch calling');
});
watch('a.1', ({ isClone, oldValue, newValue }) => {
cursor_1.watch(bundleChanges, 'a.1', ({ newValue }) => {
throw new Error('"a.1" path is not changed, wrong watch calling');
});
watch('b', ({ isClone, oldValue, newValue }) => {
cursor_1.watch(bundleChanges, 'b', ({ newValue }) => {
throw new Error('"b" path is not changed, wrong watch calling');

@@ -100,0 +83,0 @@ });

@@ -5,13 +5,15 @@ "use strict";

const bundle_1 = require("./bundle");
const bundle_doc_1 = require("./bundle-doc");
const cursor_1 = require("./cursor");
const cursor_doc_1 = require("./cursor-doc");
const stackable_cursor_1 = require("./stackable-cursor");
const cursors_manager_1 = require("./cursors-manager");
const childs_cursors_manager_1 = require("./childs-cursors-manager");
const spray_1 = require("./spray");
describe('AncientSouls/Cursor:', () => {
bundle_1.default();
bundle_doc_1.default();
cursor_1.default();
cursor_doc_1.default();
stackable_cursor_1.default();
cursors_manager_1.default();
childs_cursors_manager_1.default();
spray_1.default();
});
//# sourceMappingURL=index.js.map

@@ -56,2 +56,19 @@ "use strict";

});
it('Reset after exec()', () => {
const cursor = new stackable_cursor_1.StackableCursor();
cursor.exec(undefined, { a: [{ b: { c: 123 } }] });
cursor.apply({ indexInStack: 2, type: 'set', path: 'a.0.b.c', value: 345 });
chai_1.assert.equal(_.size(cursor.bundlesStack), 1);
chai_1.assert.equal(cursor.nextBundleIndex, 0);
chai_1.assert.equal(cursor.get('a.0.b.c'), 123);
cursor.apply({ indexInStack: 0, type: 'set', path: 'a.0.b.c', value: 456 });
chai_1.assert.equal(_.size(cursor.bundlesStack), 1);
chai_1.assert.equal(cursor.nextBundleIndex, 1);
chai_1.assert.equal(cursor.get('a.0.b.c'), 456);
cursor.exec(undefined, { a: [{ b: { c: 123 } }] });
cursor.apply({ indexInStack: 0, type: 'set', path: 'a.0.b.c', value: 234 });
chai_1.assert.equal(_.size(cursor.bundlesStack), 0);
chai_1.assert.equal(cursor.nextBundleIndex, 1);
chai_1.assert.equal(cursor.get('a.0.b.c'), 234);
});
});

@@ -58,0 +75,0 @@ }

@@ -10,2 +10,3 @@ {

"function-name": false,
"max-line-length": false,
"variable-name": [

@@ -12,0 +13,0 @@ true,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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