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

@mmckegg/mutant

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mmckegg/mutant - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

8

array.js

@@ -56,2 +56,10 @@ var LazyWatcher = require('./lib/lazy-watcher')

observable.forEach = function (fn, context) {
sources.slice().forEach(fn, context)
}
observable.find = function (fn) {
return sources.find(fn)
}
observable.indexOf

@@ -58,0 +66,0 @@

4

computed.js

@@ -81,2 +81,6 @@ /* A lazy binding take on computed */

this.lazy = true
if (this.opts && this.opts.onListen) {
this.opts.onListen()
}
}

@@ -83,0 +87,0 @@ },

12

html-element.js

@@ -61,3 +61,3 @@ var applyProperties = require('./lib/apply-properties')

var nodes = getNodes(document, resolve(node))
nodes.forEach(append, target)
nodes.forEach(append, { target: target, document: document })
data.targets.set(node, nodes)

@@ -68,3 +68,5 @@ data.bindings.push(new Binding(document, node, data))

target.appendChild(node)
walk(node, rebind)
if (target.rootNode === document) {
walk(node, rebind)
}
}

@@ -74,4 +76,6 @@ }

function append (child) {
this.appendChild(child)
walk(child, rebind)
this.target.appendChild(child)
if (this.target.rootNode === this.document) {
walk(child, rebind)
}
}

@@ -78,0 +82,0 @@

module.exports = function (update, onBind, onUnbind) {
var lazy = false
var listeners = []

@@ -10,2 +9,3 @@ var obj = {

value: null,
listeners: [],

@@ -31,3 +31,3 @@ onUpdate: function () {

listeners.push(listener)
obj.listeners.push(listener)

@@ -41,9 +41,9 @@ if (!obj.live) {

return function release () {
for (var i = 0, len = listeners.length; i < len; i++) {
if (listeners[i] === listener) {
listeners.splice(i, 1)
for (var i = 0, len = obj.listeners.length; i < len; i++) {
if (obj.listeners[i] === listener) {
obj.listeners.splice(i, 1)
break
}
}
if (!listeners.length && obj.live) {
if (!obj.listeners.length && obj.live) {
obj.live = false

@@ -61,3 +61,3 @@ onUnbind()

function broadcast () {
var cachedListeners = listeners.slice(0)
var cachedListeners = obj.listeners.slice(0)
for (var i = 0, len = cachedListeners.length; i < len; i++) {

@@ -64,0 +64,0 @@ cachedListeners[i](obj.value)

@@ -10,8 +10,8 @@ module.exports = function walk (node, fn) {

function nextNode (current, root) {
var result = current.firstChild || current.nextSibling
if (!result && current.parentNode && current.parentNode !== root) {
return current.nextSibling
} else {
return result
var result = current.firstChild
while (current && !result && current !== root) {
result = current.nextSibling
current = current.parentNode
}
return result
}
var resolve = require('./resolve')
var LazyWatcher = require('./lib/lazy-watcher')
var isReferenceType = require('./lib/is-reference-type')

@@ -65,2 +66,3 @@ module.exports = Map

rebindAll()
lastValues.clear()
}

@@ -94,6 +96,8 @@

// clean up cache
var oldLength = items.length
Array.from(lastValues.keys()).filter(notIncluded, obs).forEach(deleteEntry, lastValues)
items.length = getLength(obs)
values.length = items.length
for (var index = items.length; index < raw.length; index++) {
raw.length = items.length
for (var index = items.length; index < oldLength; index++) {
rebind(index)

@@ -128,3 +132,3 @@ }

var item = get(obs, i)
if (typeof item === 'object') {
if (isReferenceType(item)) {
raw[i] = lambda(item)

@@ -131,0 +135,0 @@ } else {

{
"name": "@mmckegg/mutant",
"version": "2.1.0",
"version": "2.2.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "array.js",

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

var Value = require('./value')
var LazyWatcher = require('./lib/lazy-watcher')

@@ -10,2 +10,5 @@ module.exports = Set

var binder = LazyWatcher(update, listen, unlisten)
binder.value = object
if (defaultValues && defaultValues.length) {

@@ -15,5 +18,2 @@ defaultValues.forEach(function (valueOrObs) {

sources.push(valueOrObs)
releases[sources.length - 1] = typeof valueOrObs === 'function'
? valueOrObs(refresh)
: null
}

@@ -24,4 +24,8 @@ })

var observable = Value(object)
var broadcast = observable.set
var observable = function MutantSet (listener) {
if (!listener) {
return binder.getValue()
}
return binder.addListener(listener)
}

@@ -31,6 +35,6 @@ observable.add = function (valueOrObs) {

sources.push(valueOrObs)
releases[sources.length - 1] = typeof valueOrObs === 'function'
? valueOrObs(refresh)
: null
refresh()
if (binder.live) {
releases[sources.length - 1] = bind(valueOrObs)
}
binder.onUpdate()
}

@@ -43,3 +47,3 @@ }

releases.length = 0
refresh()
binder.onUpdate()
}

@@ -52,3 +56,3 @@

releases.splice(index, 1).forEach(tryInvoke)
refresh()
binder.onUpdate()
}

@@ -66,3 +70,3 @@ }

})
refresh()
binder.onUpdate()
}

@@ -78,11 +82,19 @@

observable.destroy = observable.clear
return observable
function refresh () {
update()
broadcast(object)
function bind (valueOrObs) {
return typeof valueOrObs === 'function' ? valueOrObs(binder.onUpdate) : null
}
function listen () {
sources.forEach(function (obs, i) {
releases[i] = bind(obs)
})
}
function unlisten () {
releases.forEach(tryInvoke)
releases.length = 0
}
function update () {

@@ -89,0 +101,0 @@ var currentValues = object.map(get)

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