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

brisky-struct

Package Overview
Dependencies
Maintainers
1
Versions
397
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brisky-struct - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

test/context/props.js

12

lib/get/index.js

@@ -24,4 +24,12 @@ const get = (t, key, noContext) => {

const getOrigin = (t, key) => t && (get(t, key) ||
(t = t.val) && typeof t === 'object' && t.inherits && getOrigin(t, key))
const getOrigin = (t, key) => {
if (t) {
let result = get(t, key)
if (result !== void 0 && result !== null) {
return result
} else {
return (t = t.val) && typeof t === 'object' && t.inherits && getOrigin(t, key)
}
}
}

@@ -28,0 +36,0 @@ const getFn = t => t.fn || t.inherits && getFn(t.inherits)

2

lib/keys.js

@@ -66,3 +66,3 @@ const removeKey = (t, key) => {

exports.removeContextKey = removeContextKey
exports.getKeys = getKeys // add this to get perhaps
exports.getKeys = getKeys
exports.copy = copy

@@ -42,3 +42,3 @@ const { create, set } = require('../manipulate')

t.props[key] && t.props[key].struct === struct ||
t.inherits && notSelf(t.inherits)
t.inherits && notSelf(t.inherits, key, struct)

@@ -45,0 +45,0 @@ const parse = (t, val, key, stamp, props) => {

@@ -156,3 +156,3 @@ 'use strict'

if (hot[j] === void 0) {
hot.splice(j, 3)
hot.splice(j, 3) // splice is slow
checks--

@@ -159,0 +159,0 @@ }

@@ -5,6 +5,4 @@ var property, any, root, parent, $switch

var changed
// console.log(t && t.path()) need to limit composite diffs
for (let key in subs) {
// key === '$' // remove _ add it to props
if (key !== 'val' && key !== 'props' && key !== '_') { // key !== '$remove' this will become special
if (key !== 'val' && key !== 'props' && key !== '_' && key !== '$blockRemove') {
if (parse(key, t, subs, cb, tree, removed)) {

@@ -11,0 +9,0 @@ changed = true

@@ -1,6 +0,5 @@

'use strict'
const { diff } = require('./diff')
const bs = require('brisky-stamp')
// add ref supports here -- use references field in proeprty or even simpler
// add ref supports here -- use references field in prop or even simpler
const subscribe = (t, subs, cb, tree) => {

@@ -7,0 +6,0 @@ var inProgress

@@ -6,3 +6,5 @@ const { diff } = require('../diff')

if (subs.val) { cb(t, 'remove', subs, tree) }
diff(t, subs, cb, tree, true)
if (!subs.$blockRemove) {
diff(t, subs, cb, tree, true)
}
const key = tree._key

@@ -9,0 +11,0 @@ if (tree.$c) { composite(tree._p, key) }

@@ -46,5 +46,5 @@ const { diff } = require('./diff')

const body = (key, t, subs, cb, tree, removed, $switch, diffit) => {
var branch = tree[key]
var result
if (!removed && t) { result = $switch(t, subs, tree, key) }
var branch = tree[key]
if (!result) {

@@ -75,13 +75,13 @@ if (branch) {

} else {
if (a._) {
return a._ !== b._
}
for (let key in a) {
if (key !== 'props' && key !== '_') {
if (a[key] !== b[key]) {
if (typeof a[key] === 'function' && typeof b[key] === 'function') {
// console.log('function compare... danger...') will optmize this
if (a[key].toString() !== b[key].toString()) {
return true
}
} else if (typeof a[key] !== 'object' || typeof b[key] !== 'object' || isSwitched(a[key], b[key])) {
if (a[key] !== b[key]) {
if (typeof a[key] === 'function' && typeof b[key] === 'function') {
if (a[key].toString() !== b[key].toString()) {
return true
}
} else if (typeof a[key] !== 'object' || typeof b[key] !== 'object' || isSwitched(a[key], b[key])) {
return true
}

@@ -91,3 +91,3 @@ }

for (let key in b) {
if (key !== 'props' && key !== '_' && !a[key]) { return true }
if (key !== 'props' && !a[key]) { return true }
}

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

{
"name": "brisky-struct",
"description": "An observable data structure",
"version": "0.0.18",
"version": "0.0.19",
"main": "lib/index.js",
"scripts": {
"test": "(ducktape; node test) | tap-difflet && standard",
"dev": "nodemon --harmony-async-await test | tap-difflet",
"test": "(ducktape; node test) | tap-spec && standard",
"dev": "nodemon --harmony-async-await test | tap-spec",
"dev-browser": "budo ./test/index.js -p 8080 --live",
"dev-perf": "nodemon test/performance/index.js --expose-gc | tap-difflet",
"dev-perf-transpile": "cd ./test/performance && buble ./index.js | node | tap-difflet",
"dev-perf": "nodemon test/performance/index.js --expose-gc | tap-spec",
"dev-perf-transpile": "cd ./test/performance && buble ./index.js | node | tap-spec",
"dev-perf-browser": "budo ./test/performance/index.js -p 8080 --live",

@@ -26,6 +26,9 @@ "dev-perf-webgl": "budo ./test/performance/webgl.js -p 8080 --live",

"functional",
"memory optmization"
"memory efficient",
"subscriptions",
"realtime",
"observable"
],
"dependencies": {
"brisky-stamp": "^2.0.4",
"brisky-stamp": "^2.1.1",
"bubleify": "0.5.1",

@@ -58,3 +61,3 @@ "monotonic-timestamp": "0.0.9"

"stats-js": "1.0.0-alpha1",
"tap-difflet": "0.6.0",
"tap-spec": "4.1.1",
"tape": "4.6.0",

@@ -61,0 +64,0 @@ "vigour-observable": "^3.0.0",

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

const scnt = global.briskystamp.cnt
const scnt = stamp.cnt
const s = stamp.create('click')

@@ -30,0 +30,0 @@

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

require('./remove')
require('./props')

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

require('./context')
require('./types')

@@ -16,2 +15,3 @@ require('./get')

require('./references')
require('./context')
require('./subscribe')

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

volume: val,
mass: s.get('density').compute() * val
mass: s.get('density') * val
})

@@ -45,21 +45,20 @@ },

s.set({
volume: val / s.get('density').compute(),
volume: val / s.get('density'),
mass: val
})
}
},
density: true,
melting: true
},
density: 1
density: 1,
melting: 0
}
},
water: {
melting: 0
},
gold: {
density: 19.3,
melting: 1064.18
}
water: {}
})
t.equal(s.get(['water', 'density']).compute(), 1, 'density of water is 1')
t.equal(s.get(['water', 'density']), 1, 'density of water is 1')
t.equal(s.get(['water', 'melting']), 0, 'melting point of water is 0')
s.set({ gold: { density: 19.3, melting: 1064.18 } })
t.equal(s.get(['gold', 'density']).compute(), 19.3, 'density of gold is 19.3')
t.equal(s.get(['gold', 'density']), 19.3, 'density of gold is 19.3')
s.set({ water: { _volume: 10 } })

@@ -66,0 +65,0 @@ s.set({ gold: { _mass: 193 } })

require('./basic')
require('./any')
require('./composite')
require('./switch')
require('./method')
require('./references')
require('./switch')

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

test('subscription - $switch - forceCompare', t => {
const s = subsTest(t, {
field: 'a',
x: 100
}, {
field: {
$switch: (t, subs, tree) => {
if (t.compute() === 'a') {
return { root: { x: { val: true } }, _: 'ha' }
} else {
return { root: { x: { val: true } }, _: 'bla' }
}
}
}
})
s('initial subscription', [ { path: 'x', type: 'new' } ])
s('initial subscription', [ { path: 'x', type: 'remove' }, { path: 'x', type: 'new' } ], { field: 'x' })
t.end()
})
test('subscription - $switch - basic', t => {

@@ -7,0 +27,0 @@ const s = subsTest(t, {

require('./basic')
require('./remove')

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