Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

baobab

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baobab - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

2

bower.json
{
"name": "baobab",
"main": "build/baobab.min.js",
"version": "0.4.2",
"version": "0.4.3",
"homepage": "https://github.com/Yomguithereal/baobab",

@@ -6,0 +6,0 @@ "author": {

@@ -12,3 +12,3 @@ /**

Object.defineProperty(Baobab, 'version', {
value: '0.4.2'
value: '0.4.3'
});

@@ -15,0 +15,0 @@

{
"name": "baobab",
"version": "0.4.2",
"version": "0.4.3",
"description": "JavaScript data tree with cursors.",

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

@@ -385,2 +385,15 @@ [![Build Status](https://travis-ci.org/Yomguithereal/baobab.svg)](https://travis-ci.org/Yomguithereal/baobab)

});
// Cursor(s) can also be specified using a function
// (if you need props, for instance)
var UserListItem = React.createClass({
mixins: [tree.mixin],
cursor: function() {
return ['users', this.props.index];
},
render: function() {
var name = this.cursor.get();
return <li>{name}</li>;
}
});
```

@@ -387,0 +400,0 @@

@@ -149,7 +149,2 @@ /**

// Baobab-level update event
this.emit('update', {
log: log
});
// Resetting

@@ -161,2 +156,7 @@ this._transaction = {};

// Baobab-level update event
this.emit('update', {
log: log
});
return this;

@@ -163,0 +163,0 @@ };

@@ -41,4 +41,8 @@ /**

if (!type.MixinCursor(this.cursor))
throw Error('baobab.mixin.cursor: invalid data (cursor, string or array).');
throw Error('baobab.mixin.cursor: invalid data (cursor, ' +
'string, array or function).');
if (type.Function(this.cursor))
this.cursor = this.cursor();
if (!type.Cursor(this.cursor))

@@ -53,5 +57,8 @@ this.cursor = baobab.select(this.cursor);

else if (this.cursors) {
if (['object', 'array'].indexOf(type(this.cursors)) === -1)
throw Error('baobab.mixin.cursor: invalid data (object or array).');
if (!type.MixinCursors(this.cursors))
throw Error('baobab.mixin.cursor: invalid data (object, array or function).');
if (type.Function(this.cursors))
this.cursors = this.cursors();
if (type.Array(this.cursors)) {

@@ -58,0 +65,0 @@ this.cursors = this.cursors.map(function(path) {

@@ -91,8 +91,14 @@ /**

// string|number|array|cursor
// string|number|array|cursor|function
type.MixinCursor = function (value) {
var allowedValues = ['string', 'number', 'array'];
var allowedValues = ['string', 'number', 'array', 'function'];
return allowedValues.indexOf(type(value)) >= 0 || type.Cursor(value);
};
// array|object|function
type.MixinCursors = function (value) {
var allowedValues = ['array', 'object', 'function'];
return allowedValues.indexOf(type(value)) >= 0;
};
// Already know this is an array

@@ -99,0 +105,0 @@ type.ComplexPath = function (value) {

@@ -101,5 +101,7 @@ /**

}
else if ('$apply' in (spec[k] || {})) {
fn = spec[k].$apply;
else if ('$apply' in (spec[k] || {}) || '$chain' in (spec[k] || {})) {
// TODO: this should not happen likewise.
fn = spec[k].$apply || spec[k].$chain;
if (typeof fn !== 'function')

@@ -106,0 +108,0 @@ throw makeError(path.concat(k), 'using command $apply with a non function');

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