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

to
0.1.1

2

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

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

@@ -70,3 +70,3 @@ import { Leaf } from '../index'

})
if (found) {
if (!Array.isArray(found)) {
return new Leaf(branch, found)

@@ -73,0 +73,0 @@ }

@@ -57,6 +57,3 @@ import { create, Leaf } from '../index'

define(leaf, 'origin', function () {
const originLeaf = origin(this.branch, this.leaf)
if (originLeaf) {
return new Leaf(this.branch, originLeaf)
}
return new Leaf(this.branch, origin(this.branch, this.leaf))
})

@@ -63,0 +60,0 @@

@@ -57,7 +57,4 @@ import { Leaf } from '../../index'

emitOwn(branch, branch.leaves[rF], event, val, stamp)
emitOwnReferences(branch, branch.leaves[rF], event, val, stamp, references)
if (branch.rF[branch.leaves[rF].id]) {
emitBranchReferences(branch, branch.leaves[rF], event, val, stamp, references)
}
if (branch.branches.length) {

@@ -64,0 +61,0 @@ emitReferenceBranches(branch.branches, branch.leaves[rF], event, val, stamp, references)

@@ -269,2 +269,7 @@ const test = require('tape')

t.equals(
branch1.find(item => item.get('favourite').compute()),
void 0,
'branch1.find() = undefined'
)
t.equals(
branch1.find(item => item.get('name').compute() === 'third').get('name').compute(),

@@ -271,0 +276,0 @@ 'third',

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

pointers: {
pointer4: ['@', 'pointers', 'pointer1']
pointer4: ['@', 'pointers', 'pointer1'],
pointer5: ['@', 'pointers', 'pointer4']
}

@@ -338,3 +339,3 @@ })

branch1.get(['pointers', 'pointer1']).on('data', (type, stamp, item) => {
branch1.get(['pointers', 'pointer5']).on('data', (type, stamp, item) => {
branch1Fire.push(`${item.root().get('id').compute()}-${type}-${item.compute()}`)

@@ -341,0 +342,0 @@ })

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

id: 1
}
},
pointer1: {},
pointer2: [ '@', 'pointer1' ]
})
const branch1 = master.create({
id: 'branch1'
id: 'branch1',
pointer1: [ '@', 'first', 'id' ]
})

@@ -47,2 +50,5 @@

)
branch1.get([ 'pointer2' ]).on('success', (val, stamp, item) =>
branch1Fire.push(`${item.root().get('id').compute()}-${val}`)
)

@@ -59,4 +65,11 @@ master.get([ 'first', 'id' ]).emit('success', 'value3')

branch1Fire,
[ 'branch1-value1', 'branch1-value2', 'branch1-value3', 'branch1-value4' ],
'branch1Fire = [ branch1-value1, branch1-value2, branch1-value3, branch1-value4 ]'
[
'branch1-value1',
'branch1-value2',
'branch1-value3',
'branch1-value3',
'branch1-value4',
'branch1-value4'
],
'branch1Fire = correct'
)

@@ -96,2 +109,3 @@

master.emit('fail', 'value1')
branch1.off('fail', 'listener1')
branch1.emit('success', 'value2')

@@ -159,2 +173,5 @@

)
master.get([ 'first', 'id' ]).on('success', (val, stamp, item) =>
masterFire.push(`${item.root().get('id').compute()}-${val}`)
)
branch1.get([ 'first', 'id' ]).on('success', (val, stamp, item) =>

@@ -177,4 +194,4 @@ branch1Fire.push(`${item.root().get('id').compute()}-${val}`)

masterFire,
[ 'master-value1', 'master-value4' ],
'masterFire = [ master-value1, master-value4 ]'
[ 'master-value1', 'master-value1', 'master-value4', 'master-value4' ],
'masterFire = correct'
)

@@ -181,0 +198,0 @@ t.same(

@@ -256,2 +256,24 @@ const test = require('tape')

test('root operations', t => {
const master = create({
real: 'thing'
})
t.equals(
master.parent(),
void 0,
'root does not have parent'
)
master.set(null)
t.same(
master.serialize(),
{},
'remove on root works'
)
t.end()
})
test('create from leaf', t => {

@@ -273,1 +295,36 @@ const master = create({

})
test('do not set in reference get', t => {
const master = create({
key1: {
key2: {
key3: 'thing'
}
},
pointer: [ '@', 'key1' ]
})
master.get([ 'pointer', 'key2', 'key31' ], 'thing2')
master.get([ 'pointer', 'key22', 'key32' ], 'thing3')
t.same(
master.serialize(),
{
key1: {
key2: {
key3: 'thing',
key31: 'thing2'
}
},
pointer: {
key22: {
key32: 'thing3'
},
val: [ '@', 'key1' ]
}
},
'master.serialize() = correct'
)
t.end()
})