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

probe

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

probe - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

46

modules/index.js

@@ -9,3 +9,3 @@ 'use strict';

var newKeyPath = Providence.prototype.__utils.newKeyPath;
var newPath = Providence.prototype.__utils.newPath;

@@ -21,3 +21,3 @@ /* constants */

var LISTENERS_PATH = [LISTENERS];
var KEYPATH_PATH = ['keyPath'];
var PATH_PATH = ['path'];
var _ONUPDATE_PATH = ['_onUpdate']; // internal _onUpdate

@@ -51,5 +51,6 @@

var _onUpdate = function _onUpdate(options, keyPath, newRoot, oldRoot) {
var _onUpdate = function _onUpdate(options, path, newRoot, oldRoot) {
// TODO: add test case for propagate
notifyListeners(options, keyPath, newRoot, oldRoot, options.get('propagate', true));
// note: path has been sliced
notifyListeners(options, path, newRoot, oldRoot, options.get('propagate', true));
};

@@ -75,3 +76,3 @@

/**
* Add observer/listener to listen for changes at this Probe object's keypath.
* Add observer/listener to listen for changes at this Probe object's path.
* Be aware that observation isn't scoped to the root data.

@@ -90,3 +91,3 @@ *

/**
* Remove observer at this Probe object's keypath.
* Remove observer at this Probe object's path.
*

@@ -100,3 +101,3 @@ * @param {Function} listener

/**
* Add listener that'll be called whenever event occurs at keypath.
* Add listener that'll be called whenever event occurs at path.
*

@@ -123,8 +124,8 @@ * event may be one of: any, update, swap, add, remove, delete

var listeners = boxed.data;
var keyPath = options.getIn(KEYPATH_PATH);
var path = options.getIn(PATH_PATH);
var listenerKeyPath = newKeyPath(keyPath, [listenerKey, listener]);
var listenerPath = newPath(path, [listenerKey, listener]);
if (!listeners.hasIn(listenerKeyPath)) {
boxed.data = listeners.setIn(listenerKeyPath, listener);
if (!listeners.hasIn(listenerPath)) {
boxed.data = listeners.setIn(listenerPath, listener);
}

@@ -171,3 +172,3 @@

* Remove listener, if it exists, from event.
* If the same listener is observing another event at the same keypath, that
* If the same listener is observing another event at the same path, that
* listener will not be removed.

@@ -213,7 +214,7 @@ *

var listeners = boxed.data;
var keyPath = options.getIn(KEYPATH_PATH);
var path = options.getIn(PATH_PATH);
var listenerKeyPath = newKeyPath(keyPath, pathToDelete);
var listenerPath = newPath(path, pathToDelete);
boxed.data = listeners.deleteIn(listenerKeyPath);
boxed.data = listeners.deleteIn(listenerPath);
}

@@ -260,2 +261,3 @@

function callListeners(observers, currentNew, currentOld) {
var pathToChange = arguments[3] === undefined ? void 0 : arguments[3];

@@ -266,3 +268,3 @@ var newSet = currentNew !== NOT_SET;

var __currentOld = oldSet ? currentOld : void 0;
var args = [__currentNew, __currentOld];
var args = [__currentNew, __currentOld, pathToChange];
var observersAny = observers.observersAny;

@@ -283,3 +285,3 @@ var observersAdd = observers.observersAdd;

function notifyListeners(options, keyPath, newRoot, oldRoot) {
function notifyListeners(options, path, newRoot, oldRoot) {
var propagate = arguments[4] === undefined ? true : arguments[4];

@@ -295,5 +297,6 @@

var n = 0;
var len = keyPath.length;
var len = path.length;
var pathToChange = path.slice();
// notify listeners for every subpath of keyPath
// notify listeners for every subpath of path
//

@@ -306,6 +309,7 @@ // invariant:

if (propagate) {
callListeners(extractListeners(current), currentNew, currentOld);
callListeners(extractListeners(current), currentNew, currentOld, pathToChange);
}
var atom = keyPath[n++];
var atom = path[n++];
pathToChange.shift();
current = current.get(atom, NOT_SET);

@@ -312,0 +316,0 @@ currentNew = currentNew === NOT_SET ? NOT_SET : currentNew.get(atom, NOT_SET);

{
"name": "probe",
"version": "0.2.2",
"version": "0.3.0",
"description": "Observable Providence cursors",

@@ -39,3 +39,3 @@ "main": "modules/index.js",

"devDependencies": {
"babel": "^5.4.4",
"babel": "^5.4.7",
"chai": "^2.3.0",

@@ -45,4 +45,4 @@ "mocha": "^2.2.5"

"dependencies": {
"providence": "^0.4.0"
"providence": "^0.5.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