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.1.3 to 0.1.4

src/api/set/index.js

2

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

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

import { keyToId, pathToIds } from '../id'
import { set } from './set'
import { setKeys } from './set/index'

@@ -44,3 +44,3 @@ const getFromLeaves = (branch, id) => {

if (!inReference && val !== void 0) {
set(branch, id, { [ key ]: val }, stamp)
setKeys(branch, id, { [ key ]: val }, stamp)
return leafId

@@ -60,3 +60,3 @@ }

if (getFromLeaves(branch, ids[i])) {
set(branch, ids[i], val, stamp)
setKeys(branch, ids[i], val, stamp)
return leafId

@@ -63,0 +63,0 @@ }

import { create, Leaf } from '../index'
import { root } from '../id'
import { createStamp } from '../stamp'
import { set } from './set'
import { set } from './set/index'
import { getFromLeaves, getApi } from './get'

@@ -6,0 +6,0 @@ import { origin, compute } from './compute'

import { getFromLeaves } from './get'
import { emit, addDataEvent } from './listeners/emit'
import { addBranchLeaf } from './set'
import { addBranchLeaf } from './set/index'
import { children } from './array'

@@ -5,0 +5,0 @@

import { root } from './id'
import { defineApi } from './api/index'
import { set } from './api/set'
import { set } from './api/set/index'
import { createStamp } from './stamp'

@@ -5,0 +5,0 @@ import { emitDataEvents } from './api/listeners/emit'

const test = require('tape')
const { create } = require('../')
const { create } = require('../dist/index')

@@ -4,0 +4,0 @@ test('path collusion', t => {

@@ -467,2 +467,5 @@ const test = require('tape')

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

@@ -549,3 +552,4 @@ })

pointers: {
pointer1: master1.get([ 'deep', 'real' ])
pointer1: master1.get([ 'pointers', 'pointer2' ]),
pointer2: master1.get([ 'deep', 'real' ])
}

@@ -560,2 +564,8 @@ })

t.equals(
branch5.get([ 'pointers', 'pointer2' ]).compute(),
'thing',
'branch5.pointers.pointer2.compute() = thing'
)
t.end()

@@ -699,1 +709,27 @@ })

})
test('references - override', t => {
const master = create({
real1: 'thing1',
real2: 'thing2',
pointer1: [ '@', 'real2' ]
})
const branch1 = master.create()
const branch2 = branch1.create({
real1: 'updated'
})
branch1.set({
pointer1: [ '@', 'real1' ]
})
t.equals(
branch2.get('pointer1').compute(),
'updated',
'branch2.pointer1.compute() = updated'
)
t.end()
})
const test = require('tape')
const { create, createStamp } = require('../')
const { create, createStamp } = require('../dist/index')

@@ -9,3 +9,4 @@ test('set - get - references', t => {

deep: {
real: 'thing'
real: 'thing',
dummy: void 0
},

@@ -202,3 +203,29 @@ pointers: {

master.set({
deep: {
real: [ 2, 3, 1 ],
other: {}
}
})
t.same(
master.get([ 'pointers', 'pointer2' ]).compute(),
[ 2, 3, 1 ],
'branch1.pointers.pointer2.compute() = [ 2, 3, 1 ]'
)
t.same(
master.serialize(),
{
deep: {
other: {},
real: [ 2, 3, 1 ]
},
pointers: {
pointer1: [ '@', 'deep', 'real' ],
pointer2: [ '@', 'pointers', 'pointer1' ]
}
},
'master.serialize() = correct'
)
t.same(
branch1.get([ 'pointers', 'pointer2' ]).compute(),

@@ -335,1 +362,21 @@ [ 3, 2, 1 ],

})
test('ignore same val in branch', t => {
const master = create({
real: 'thing'
})
const branch1 = master.create({
real: 'thing'
})
master.get('real').set('updated')
t.equals(
branch1.get('real').compute(),
'updated',
'branch1.real.compute() = updated'
)
t.end()
})
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