New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stx

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stx - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

src/api/remove.js

2

package.json
{
"name": "stx",
"version": "0.0.5",
"version": "0.0.6",
"description": "a blazing fast state manager with network sync out of the box",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -11,3 +11,5 @@ import { getString } from '../cache'

leaf = branch.leaves[id]
if (leaf && leaf.keys) {
if (leaf === null) {
return subLeaves
} else if (leaf && leaf.keys) {
const found = leaf.keys.find(leafId => {

@@ -17,7 +19,12 @@ if (exists[leafId]) {

}
exists[leafId] = getFromLeaves(oBranch, leafId)
if (cb) {
return cb(exists[leafId])
const subLeaf = getFromLeaves(oBranch, leafId)
if (subLeaf) {
exists[leafId] = subLeaf
if (cb) {
return cb(subLeaf)
} else {
subLeaves.push(subLeaf)
}
} else {
subLeaves.push(exists[leafId])
exists[leafId] = true
}

@@ -24,0 +31,0 @@ })

@@ -1,16 +0,36 @@

import { origin } from './get'
import { getFromLeaves } from './get'
const compute = (branch, leaf) => {
if (leaf) {
leaf = origin(branch, leaf)
while (leaf.val === void 0 && branch.inherits) {
if (branch.inherits.leaves[leaf.id]) {
leaf = branch.inherits.leaves[leaf.id]
const getVal = (branch, id) => {
const oBranch = branch
while (branch) {
let leaf = branch.leaves[id]
if (leaf) {
if (leaf.val !== void 0) {
return leaf.val
} else if (leaf.rT) {
return getFromLeaves(oBranch, leaf.rT)
}
branch = branch.inherits
}
return leaf.val
branch = branch.inherits
}
}
export { compute }
const compute = (branch, id) => {
const oBranch = branch
while (branch) {
const leaf = branch.leaves[id]
if (leaf) {
if (leaf.val !== void 0) {
return leaf.val
} else if (leaf.rT) {
const val = compute(oBranch, leaf.rT)
if (val !== void 0) {
return val
}
}
}
branch = branch.inherits
}
}
export { getVal, compute }

@@ -1,16 +0,10 @@

import { root, keyToId, pathToIds } from '../id'
import { keyToId, pathToIds } from '../id'
import { set } from './set'
const origin = (branch, leaf) => {
let origin = leaf
while (origin && origin.rT) {
origin = getFromLeaves(branch, origin.rT)
}
return origin
}
const getFromLeaves = (branch, id) => {
const oBranch = branch
while (branch) {
if (branch.leaves[id]) {
if (branch.leaves[id] === null) {
return null
} else if (branch.leaves[id]) {
const leaf = branch.leaves[id]

@@ -24,67 +18,73 @@ leaf.branch = oBranch

const getByKey = (branch, key, id = root, val, stamp) => {
const origin = (branch, leaf) => getFromLeaves(branch, leaf.rT) || leaf
const getByKey = (branch, id, key, val, stamp, inReference) => {
const leafId = keyToId(key, id)
let leaf = getFromLeaves(branch, leafId)
if (leaf) {
return leaf
} else if (val !== void 0) {
leaf = getFromLeaves(branch, id)
set(leaf, { [ key ]: val }, stamp, id, branch)
return getFromLeaves(branch, leafId)
const subLeaf = getFromLeaves(branch, leafId)
if (subLeaf) {
return subLeaf
} else {
const leaf = getFromLeaves(branch, id)
if (leaf.rT) {
const originSubLeaf = getByKey(branch, leaf.rT, key, val, stamp, true)
if (originSubLeaf) {
return originSubLeaf
}
}
if (!inReference && val !== void 0) {
set(branch, leaf, { [ key ]: val }, stamp)
return branch.leaves[leafId]
}
}
}
const getByPath = (branch, path, id = root, val, stamp) => {
const ids = pathToIds(path, id)
const setByPath = (branch, ids, path, val, stamp, inReference) => {
let i = ids.length - 1
const leafId = ids[i]
let leaf = getFromLeaves(branch, leafId)
if (leaf) {
return leaf
} else if (val !== void 0) {
while (i) {
val = { [ path.splice(i) ]: val }
i--
let leaf = getFromLeaves(branch, ids[i])
if (leaf) {
set(leaf, val, stamp, ids[i], branch)
return getFromLeaves(branch, leafId)
}
while (i--) {
if (i === 0 && inReference) {
return
}
val = { [ path.pop() ]: val }
const leaf = getFromLeaves(branch, ids[i])
if (leaf) {
set(branch, leaf, val, stamp)
return branch.leaves[leafId]
}
}
}
const getApi = (branch, path, id = root, val, stamp) => {
if (Array.isArray(path)) {
const ids = pathToIds(path, id)
let i = ids.length - 1
const leafId = ids[i]
let leaf = getFromLeaves(branch, leafId)
if (leaf) {
return leaf
} else if (val === void 0) {
while (i) {
let leaf = getFromLeaves(branch, ids[i])
if (leaf && (leaf = origin(branch, leaf))) {
return getApi(branch, path.slice(i + 1), leaf.id, val, stamp)
const getByPath = (branch, id, path, val, stamp, inReference) => {
const ids = pathToIds(path, id)
let i = ids.length - 1
const subLeaf = getFromLeaves(branch, ids[i])
if (subLeaf) {
return subLeaf
} else {
while (i--) {
const leaf = getFromLeaves(branch, ids[i])
if (leaf && leaf.rT) {
const originSubLeaf = getByPath(
branch, leaf.rT, path.slice(i), val, stamp, true
)
if (originSubLeaf) {
return originSubLeaf
}
i--
}
} else {
while (i) {
val = { [ path.splice(i) ]: val }
i--
let leaf = getFromLeaves(branch, ids[i])
if (leaf) {
set(leaf, val, stamp, ids[i], branch)
leaf = getFromLeaves(branch, leafId)
return origin(branch, leaf) || leaf
}
}
}
if (val !== void 0) {
return setByPath(branch, ids, path, val, stamp, inReference)
}
}
}
const getApi = (branch, id, path, val, stamp) => {
if (Array.isArray(path)) {
return getByPath(branch, id, path, val, stamp)
} else {
return getByKey(branch, path, id, val, stamp)
return getByKey(branch, id, path, val, stamp)
}
}
export { origin, getFromLeaves, getByKey, getByPath, getApi }
export { getFromLeaves, origin, getByKey, getByPath, getApi }

@@ -5,3 +5,3 @@ import { Struct } from '../index'

import { set } from './set'
import { origin, getFromLeaves, getApi } from './get'
import { getFromLeaves, origin, getApi } from './get'
import { compute } from './compute'

@@ -20,6 +20,6 @@ import { forEach, map, filter, find, reduce } from './array'

define(leaf, 'set', function (val, stamp) {
set(this, val, stamp, this.id, this.branch)
set(this.branch, this, val, stamp)
})
define(struct, 'set', function (val, stamp) {
set(this.leaves[root], val, stamp, root, this)
set(this, this.leaves[root], val, stamp)
})

@@ -29,6 +29,6 @@

define(leaf, 'get', function (path, val, stamp) {
return getApi(this.branch, path, this.id, val, stamp)
return getApi(this.branch, this.id, path, val, stamp)
})
define(struct, 'get', function (path, val, stamp) {
return getApi(this, path, root, val, stamp)
return getApi(this, root, path, val, stamp)
})

@@ -132,3 +132,3 @@

define(leaf, 'compute', function () {
return compute(this.branch, this)
return compute(this.branch, this.id)
})

@@ -135,0 +135,0 @@

import { getString } from '../cache'
import { getFromLeaves } from './get'
import { getVal } from './compute'
import { children } from './array'
const inspect = (branch, leaf) => {
let val = leaf.val
const subLeaves = children(branch, leaf)
const start = 'Struct ' + (leaf.key ? getString(leaf.key) + ' ' : '')
const origin = leaf.rT && getFromLeaves(branch, leaf.rT)
if (origin) {
val = inspect(branch, origin)
let val = getVal(branch, leaf.id)
if (val && val.isLeaf) {
val = inspect(branch, val)
}

@@ -33,6 +32,5 @@ if (subLeaves.length) {

const serialize = (branch, leaf) => {
let val = leaf.val
const origin = leaf.rT && getFromLeaves(branch, leaf.rT)
if (origin) {
val = [ '@' ].concat(origin.path())
let val = getVal(branch, leaf.id)
if (val && val.isLeaf) {
val = [ '@' ].concat(val.path())
}

@@ -42,7 +40,4 @@ let child = false

children(branch, leaf, subLeaf => {
const keyResult = serialize(branch, subLeaf)
if (keyResult !== void 0) {
child = true
result[getString(subLeaf.key)] = keyResult
}
child = true
result[getString(subLeaf.key)] = serialize(branch, subLeaf)
})

@@ -56,2 +51,4 @@ if (child) {

return val
} else {
return {}
}

@@ -58,0 +55,0 @@ }

@@ -5,8 +5,12 @@ import { Leaf } from '../index'

import { getFromLeaves, getByPath } from './get'
import { remove, removeReference } from './remove'
const setVal = (leaf, val, stamp, id, branch) => {
if (leaf.kBranch !== branch) {
branch.leaves[id] = leaf = new Leaf(val, stamp, id, branch, leaf.p, leaf.key)
const setVal = (branch, leaf, val, stamp) => {
if (leaf.struct !== branch) {
branch.leaves[leaf.id] = leaf = new Leaf(
branch, leaf.id, val, stamp, leaf.p, leaf.key
)
} else if (val !== void 0) {
leaf.val = val
removeReference(branch, leaf, stamp)
}

@@ -16,14 +20,13 @@ return leaf

const setReferenceByPath = (leaf, path, stamp, id, branch) =>
set(leaf, getByPath(branch, path, root, {}, stamp), stamp, id, branch)
const setReferenceByPath = (branch, leaf, path, stamp) =>
set(branch, leaf, getByPath(branch, root, path, {}, stamp), stamp)
const setReference = (leaf, val, stamp, id, branch) => {
const setReference = (branch, leaf, val, stamp) => {
const oBranch = branch
while (branch) {
if (branch === val.branch) {
leaf = setVal(leaf, void 0, stamp, id, branch)
leaf = setVal(oBranch, leaf, void 0, stamp)
leaf.val = void 0
leaf.rT = val.id
if (branch !== oBranch) {
id = [oBranch, id]
}
const id = branch === oBranch ? leaf.id : [ oBranch, leaf.id ]
if (val.rF) {

@@ -41,17 +44,22 @@ val.rF.push(id)

const setKeys = (leaf, val, stamp, id, branch) => {
const setKeys = (branch, leaf, val, stamp, isSubLeaf) => {
let keys = []
for (let key in val) {
if (key === 'val') {
setVal(leaf, val.val, stamp, id, branch)
set(branch, leaf, val.val, stamp)
} else {
const leafId = keyToId(key, id)
const existing = getFromLeaves(branch, leafId)
const subLeafId = keyToId(key, leaf.id)
const existing = getFromLeaves(branch, subLeafId)
if (existing) {
set(existing, val[key], stamp, leafId, branch)
set(branch, existing, val[key], stamp)
if (isSubLeaf) {
keys.push(subLeafId)
}
} else {
const keyId = keyToId(key)
addToStrings(keyId, key)
keys.push(leafId)
branch.leaves[leafId] = new Leaf(val[key], stamp, leafId, branch, id, keyId)
keys.push(subLeafId)
branch.leaves[subLeafId] = new Leaf(
branch, subLeafId, val[key], stamp, leaf.id, keyId, true
)
}

@@ -61,3 +69,3 @@ }

if (keys.length) {
leaf = setVal(leaf, void 0, stamp, id, branch)
leaf = setVal(branch, leaf, void 0, stamp)
leaf.keys = leaf.keys ? leaf.keys.concat(keys) : keys

@@ -67,19 +75,19 @@ }

const set = (leaf, val, stamp, id, branch) => {
const set = (branch, leaf, val, stamp, isSubLeaf) => {
if (typeof val === 'object') {
if (!val) {
// TODO: handle removal
remove(branch, leaf, stamp)
} else if (Array.isArray(val)) {
if (val[0] === '@') {
setReferenceByPath(leaf, val.slice(1), stamp, id, branch)
setReferenceByPath(branch, leaf, val.slice(1), stamp)
} else {
setVal(leaf, val, stamp, id, branch)
setVal(branch, leaf, val, stamp)
}
} else if (val.isLeaf) {
setReference(leaf, val, stamp, id, branch)
setReference(branch, leaf, val, stamp)
} else {
setKeys(leaf, val, stamp, id, branch)
setKeys(branch, leaf, val, stamp, isSubLeaf)
}
} else {
setVal(leaf, val, stamp, id, branch)
setVal(branch, leaf, val, stamp)
}

@@ -86,0 +94,0 @@ }

@@ -32,7 +32,7 @@ const root = 5381

const pathToIds = (path, id = root) =>
path.map(key => {
[ id ].concat(path.map(key => {
id = keyToId(key, id)
return id
})
}))
export { root, keyToId, arrayToId, pathToIds }
import { root } from './id'
import { defineApi, set } from './api/index'
const Leaf = function (val, stamp, id, branch, parent, key) {
const respectOverrides = (branches, id, parent) => {
branches.forEach(branch => {
if (branch.leaves[parent] === null) {
branch.leaves[id] = null
}
if (branch.branches.length) {
respectOverrides(branch.branches, id, parent)
}
})
}
const Leaf = function (branch, id, val, stamp, parent, key, isSubLeaf) {
this.id = id
this.struct = branch
this.branch = branch
if (parent) {

@@ -12,6 +25,8 @@ this.p = parent

}
this.kBranch = branch
if (val !== void 0) {
set(this, val, stamp, id, branch)
set(branch, this, val, stamp, isSubLeaf)
}
if (branch.branches.length) {
respectOverrides(branch.branches, id, parent)
}
}

@@ -26,3 +41,3 @@

}
this.leaves[root] = new Leaf(val, stamp, root, this)
this.leaves[root] = new Leaf(this, root, val, stamp)
this.leaves[root].branch = this

@@ -29,0 +44,0 @@ }

@@ -71,3 +71,3 @@ const test = require('tape')

article.forEach((prop, propName) => {
masterArray.push([id, propName, prop.compute()])
masterArray.push([ id, propName, prop.compute() ])
})

@@ -79,3 +79,3 @@ })

article.forEach((prop, propName) => {
branch1Array.push([id, propName, prop.compute()])
branch1Array.push([ id, propName, prop.compute() ])
})

@@ -87,3 +87,3 @@ })

article.forEach((prop, propName) => {
branch2Array.push([id, propName, prop.compute()])
branch2Array.push([ id, propName, prop.compute() ])
})

@@ -236,4 +236,2 @@ })

test('array api - reduce', t => {
global.debug = true
const master = new Struct({

@@ -240,0 +238,0 @@ payments: {

@@ -5,1 +5,2 @@ require('./set-get')

require('./array-api')
require('./remove')

@@ -37,11 +37,11 @@ const test = require('tape')

leaf = state.get(i)
state.get([i, 'a'])
state.get([i, 'b'])
state.get([i, 'c'])
state.get([ i, 'a' ])
state.get([ i, 'b' ])
state.get([ i, 'c' ])
leaf.get('nested')
leaf.get(['nested', 'x0'])
leaf.get(['nested', 'x1'])
leaf.get(['nested', 'x2'])
leaf.get(['nested', 'x3'])
leaf.get(['nested', 'x4'])
leaf.get([ 'nested', 'x0' ])
leaf.get([ 'nested', 'x1' ])
leaf.get([ 'nested', 'x2' ])
leaf.get([ 'nested', 'x3' ])
leaf.get([ 'nested', 'x4' ])
}

@@ -48,0 +48,0 @@ const structGet = Date.now() - d

@@ -12,4 +12,4 @@ const test = require('tape')

pointers: {
pointer1: ['@', 'deep'],
pointer2: ['@', 'deep', 'real']
pointer1: [ '@', 'deep' ],
pointer2: [ '@', 'deep', 'real' ]
}

@@ -25,5 +25,5 @@ })

pointers: {
pointer3: ['@', 'deep', 'real'],
pointer4: ['@', 'deep', 'real2'],
pointer5: ['@', 'pointers', 'pointer1']
pointer3: [ '@', 'deep', 'real' ],
pointer4: [ '@', 'deep', 'real2' ],
pointer5: [ '@', 'pointers', 'pointer1' ]
}

@@ -33,8 +33,8 @@ })

t.equals(
branch1.get(['deep', 'real']).compute(),
master.get(['deep', 'real']).compute(),
branch1.get([ 'deep', 'real' ]).compute(),
master.get([ 'deep', 'real' ]).compute(),
'branch1.deep.real = master.deep.real'
)
t.equals(
branch1.get(['deep', 'real2']).compute(),
branch1.get([ 'deep', 'real2' ]).compute(),
'thing2',

@@ -44,3 +44,3 @@ 'branch1.deep.real2.compute() = thing2'

t.equals(
master.get(['deep', 'real2']),
master.get([ 'deep', 'real2' ]),
void 0,

@@ -51,9 +51,9 @@ 'master.deep.real2 = void 0'

t.equals(
branch1.get(['pointers', 'pointer1', 'real']).compute(),
master.get(['pointers', 'pointer1', 'real']).compute(),
branch1.get([ 'pointers', 'pointer1', 'real' ]).compute(),
master.get([ 'pointers', 'pointer1', 'real' ]).compute(),
'branch1.pointers.pointer1.real.compute() = master.pointers.pointer1.real.compute()'
)
t.equals(
branch1.get(['pointers', 'pointer2']).compute(),
master.get(['pointers', 'pointer2']).compute(),
branch1.get([ 'pointers', 'pointer2' ]).compute(),
master.get([ 'pointers', 'pointer2' ]).compute(),
'branch1.pointers.pointer2.compute() = master.pointers.pointer2.compute()'

@@ -63,8 +63,8 @@ )

t.equals(
branch1.get(['pointers', 'pointer3']).compute(),
master.get(['deep', 'real']).compute(),
branch1.get([ 'pointers', 'pointer3' ]).compute(),
master.get([ 'deep', 'real' ]).compute(),
'branch1.pointers.pointer3 = master.deep.real'
)
t.equals(
master.get(['pointers', 'pointer3']),
master.get([ 'pointers', 'pointer3' ]),
void 0,

@@ -75,3 +75,3 @@ 'master.pointers.pointer3 = void 0'

t.equals(
branch1.get(['pointers', 'pointer4']).compute(),
branch1.get([ 'pointers', 'pointer4' ]).compute(),
'thing2',

@@ -81,3 +81,3 @@ 'branch1.pointers.pointer4.compute() = thing2'

t.equals(
master.get(['pointers', 'pointer4']),
master.get([ 'pointers', 'pointer4' ]),
void 0,

@@ -88,8 +88,8 @@ 'master.pointers.pointer4 = void 0'

t.equals(
branch1.get(['pointers', 'pointer5', 'real']).compute(),
master.get(['deep', 'real']).compute(),
branch1.get([ 'pointers', 'pointer5', 'real' ]).compute(),
master.get([ 'deep', 'real' ]).compute(),
'branch1.pointers.pointer5.real.compute() = master.deep.real'
)
t.equals(
master.get(['pointers', 'pointer5']),
master.get([ 'pointers', 'pointer5' ]),
void 0,

@@ -106,3 +106,3 @@ 'master.pointers.pointer5 = void 0'

t.equals(
master.get(['deep', 'real']).compute(),
master.get([ 'deep', 'real' ]).compute(),
'thing',

@@ -112,3 +112,3 @@ 'master.deep.real.compute() = thing'

t.equals(
branch1.get(['deep', 'real']).compute(),
branch1.get([ 'deep', 'real' ]).compute(),
'thing',

@@ -118,3 +118,3 @@ 'branch1.deep.real.compute() = thing'

t.equals(
branch2.get(['deep', 'real']).compute(),
branch2.get([ 'deep', 'real' ]).compute(),
'override',

@@ -124,3 +124,3 @@ 'branch2.deep.real.compute() = override'

t.equals(
branch2.get(['deep', 'real2']).compute(),
branch2.get([ 'deep', 'real2' ]).compute(),
'thing2',

@@ -131,3 +131,3 @@ 'branch2.deep.real2.compute() = thing2'

t.equals(
branch2.get(['pointers', 'pointer2']).compute(),
branch2.get([ 'pointers', 'pointer2' ]).compute(),
'override',

@@ -137,3 +137,3 @@ 'branch2.pointers.pointer2.compute() = override'

t.equals(
branch2.get(['pointers', 'pointer3']).compute(),
branch2.get([ 'pointers', 'pointer3' ]).compute(),
'override',

@@ -143,3 +143,3 @@ 'branch2.pointers.pointer3.compute() = override'

t.equals(
branch2.get(['pointers', 'pointer4']).compute(),
branch2.get([ 'pointers', 'pointer4' ]).compute(),
'thing2',

@@ -146,0 +146,0 @@ 'branch2.pointers.pointer4.compute() = thing2'

const test = require('tape')
const { Struct } = require('../')
test('set - get references', t => {
test('set - get - references', t => {
const master = new Struct()

@@ -12,6 +12,6 @@

pointers: {
pointer1: ['@', 'deep'],
pointer2: ['@', 'deep', 'real'],
pointer3: ['@', 'pointers', 'pointer1'],
pointer4: ['@', 'pointers', 'pointer2']
pointer1: [ '@', 'deep' ],
pointer2: [ '@', 'deep', 'real' ],
pointer3: [ '@', 'pointers', 'pointer1' ],
pointer4: [ '@', 'pointers', 'pointer2' ]
}

@@ -21,3 +21,3 @@ })

t.equals(
master.get(['pointers', 'pointer1', 'real']).compute(),
master.get([ 'pointers', 'pointer1', 'real' ]).compute(),
'thing',

@@ -27,3 +27,3 @@ 'pointers.pointer1.real.compute() = thing'

t.equals(
master.get(['pointers', 'pointer2']).compute(),
master.get([ 'pointers', 'pointer2' ]).compute(),
'thing',

@@ -33,3 +33,3 @@ 'pointers.pointer2.compute() = thing'

t.equals(
master.get(['pointers', 'pointer3', 'real']).compute(),
master.get([ 'pointers', 'pointer3', 'real' ]).compute(),
'thing',

@@ -39,3 +39,3 @@ 'pointers.pointer3.real.compute() = thing'

t.equals(
master.get(['pointers', 'pointer4']).compute(),
master.get([ 'pointers', 'pointer4' ]).compute(),
'thing',

@@ -55,3 +55,3 @@ 'pointers.pointer4.compute() = thing'

t.equals(
master.get(['pointers', 'pointer2']).inspect(),
master.get([ 'pointers', 'pointer2' ]).inspect(),
'Struct pointer2 { val: Struct real { val: thing } }',

@@ -61,3 +61,3 @@ 'master.pointers.pointer2.inspect() = Struct pointer2 { val: Struct real { val: thing } }'

t.same(
master.get(['deep', 'real']).path(),
master.get([ 'deep', 'real' ]).path(),
[ 'deep', 'real' ],

@@ -98,16 +98,21 @@ 'master.deep.real.path() = [ \'deep\', \'real\' ]'

real2: 'thing2'
},
pointers: {
pointer1: {
real3: 'thing3'
}
}
})
branch1.get(['pointers', 'pointer2']).set(['@', 'deep', 'real2'])
branch1.get([ 'pointers', 'pointer2' ]).set([ '@', 'deep', 'real2' ])
t.equals(
master.get('pointers').get('pointer5', ['@', 'pointers', 'pointer1']).origin().get('real').compute(),
master.get('pointers').get('pointer5', [ '@', 'pointers', 'pointer1' ]).get('real').compute(),
'thing',
'master.pointers.pointer5.origin().real.compute() = thing'
)
master.get(['pointers', 'pointer6'], ['@', 'pointers', 'pointer5'])
master.get([ 'pointers', 'pointer6' ], [ '@', 'pointers', 'pointer5' ])
t.equals(
master.get(['pointers', 'pointer6', 'real']).compute(),
master.get([ 'pointers', 'pointer6', 'real' ]).compute(),
'thing',

@@ -118,3 +123,3 @@ 'master.pointers.pointer6.real.compute() = thing'

t.equals(
branch1.get(['pointers', 'pointer2']).compute(),
branch1.get([ 'pointers', 'pointer2' ]).compute(),
'thing2',

@@ -131,3 +136,6 @@ 'branch1.pointers.pointer2.compute() = thing2'

pointers: {
pointer1: [ '@', 'deep' ],
pointer1: {
val: [ '@', 'deep' ],
real3: 'thing3'
},
pointer2: [ '@', 'deep', 'real2' ],

@@ -154,4 +162,4 @@ pointer3: [ '@', 'pointers', 'pointer1' ],

pointers: {
pointer1: ['@', 'deep', 'real'],
pointer2: ['@', 'pointers', 'pointer1']
pointer1: [ '@', 'deep', 'real' ],
pointer2: [ '@', 'pointers', 'pointer1' ]
}

@@ -161,3 +169,3 @@ })

t.same(
master.get(['pointers', 'pointer1']).compute(),
master.get([ 'pointers', 'pointer1' ]).compute(),
[ 1, 2, 3 ],

@@ -167,3 +175,3 @@ 'pointers.pointer1.compute() = [ 1, 2, 3 ]'

t.same(
master.get(['pointers', 'pointer2']).compute(),
master.get([ 'pointers', 'pointer2' ]).compute(),
[ 1, 2, 3 ],

@@ -184,4 +192,4 @@ 'pointers.pointer2.compute() = [ 1, 2, 3 ]'

pointers: {
pointer1: ['@', 'deep', 'real'],
pointer2: ['@', 'pointers', 'pointer1']
pointer1: [ '@', 'deep', 'real' ],
pointer2: [ '@', 'pointers', 'pointer1' ]
}

@@ -192,3 +200,3 @@ },

t.same(
master.get(['deep', 'real']).inspect(),
master.get([ 'deep', 'real' ]).inspect(),
'Struct real { val: 1,2,3 }',

@@ -205,3 +213,3 @@ 'master.deep.real.inspect() = Struct real { val: 1,2,3 }'

t.same(
branch1.get(['pointers', 'pointer2']).compute(),
branch1.get([ 'pointers', 'pointer2' ]).compute(),
[ 3, 2, 1 ],

@@ -208,0 +216,0 @@ 'branch1.pointers.pointer2.compute() = [ 3, 2, 1 ]'

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