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

dt-binding

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dt-binding - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

lib/util.js

221

dt-binding.browser.js

@@ -321,101 +321,7 @@ ;(function(){var require = function (file, cwd) {

(function() {
var Binding, deep_get, deep_set, functionify, isArray, multiplex, slice,
var Binding, deep_get, deep_set, multiplex, _ref,
__slice = [].slice;
slice = Array.prototype.slice;
_ref = require('./util'), deep_get = _ref.deep_get, deep_set = _ref.deep_set, multiplex = _ref.multiplex;
isArray = Array.isArray;
deep_get = function(data, keys) {
var key, next, _i, _len, _ref;
if (data == null) {
return;
}
if (!keys.length) {
return data;
}
_ref = keys.split('.');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
next = data[key];
if (typeof next === 'function') {
next = next.call(data);
}
data = next;
if (data == null) {
break;
}
}
return data;
};
deep_set = function(data, keys, value) {
var key;
if (data == null) {
return;
}
keys = keys.split('.');
key = keys.pop();
data = deep_get(data, keys.join('.'));
return data != null ? data[key] = value : void 0;
};
functionify = function(callback, args) {
var method, methods;
if (typeof callback !== 'function') {
if (isArray(callback)) {
methods = callback;
callback = function() {
var method, moargs, _i, _len, _ref, _ref1;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = methods.length; _i < _len; _i++) {
method = methods[_i];
_ref = isArray(method) ? method : [method], method = _ref[0], args = 2 <= _ref.length ? __slice.call(_ref, 1) : [];
if ((_ref1 = this[method]) != null) {
_ref1.apply(this, args.concat(moargs));
}
}
};
callback.method = methods;
} else {
method = callback;
callback = function() {
var moargs, _ref;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (_ref = this[method]) != null ? _ref.apply(this, args.concat(moargs)) : void 0;
};
callback.method = method;
}
} else {
return function() {
var moargs;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return callback.apply(this, args.concat(moargs));
};
}
return callback;
};
multiplex = function(key, callback, args, action) {
var callbacks;
if (typeof key === 'object') {
callbacks = key;
return function() {
var _results;
_results = [];
for (key in callbacks) {
callback = callbacks[key];
callback = functionify(callback, args);
_results.push(action.call(this, key, callback.bind(this)));
}
return _results;
};
} else {
callback = functionify(callback, args);
return function() {
return action.call(this, key, callback.bind(this));
};
}
};
Binding = (function() {

@@ -442,5 +348,5 @@ function Binding(data) {

Binding.prototype.unbind = function(key, callback) {
var callbacks, fun, i, _i, _len, _ref;
var callbacks, fun, i, _i, _len, _ref1;
if (callback != null) {
callbacks = (_ref = this._binds[key]) != null ? _ref : [];
callbacks = (_ref1 = this._binds[key]) != null ? _ref1 : [];
for (i = _i = 0, _len = callbacks.length; _i < _len; i = ++_i) {

@@ -459,6 +365,6 @@ fun = callbacks[i];

Binding.prototype.trigger = function(key, value) {
var callback, subkey, subval, _i, _len, _ref, _ref1;
_ref1 = (_ref = this._binds[key]) != null ? _ref : [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
callback = _ref1[_i];
var callback, subkey, subval, _i, _len, _ref1, _ref2;
_ref2 = (_ref1 = this._binds[key]) != null ? _ref1 : [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
callback = _ref2[_i];
callback(value);

@@ -504,4 +410,2 @@ }

Binding.multiplex = multiplex;
Binding.Binding = Binding;

@@ -514,2 +418,111 @@

});
require.define("/util.js", function (require, module, exports, __dirname, __filename) {
(function() {
var deep_get, deep_set, functionify, isArray, multiplex,
__slice = [].slice;
isArray = Array.isArray;
deep_get = function(data, keys) {
var key, next, _i, _len, _ref;
if (data == null) {
return;
}
if (!keys.length) {
return data;
}
_ref = keys.split('.');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
next = data[key];
if (typeof next === 'function') {
next = next.call(data);
}
data = next;
if (data == null) {
break;
}
}
return data;
};
deep_set = function(data, keys, value) {
var key;
if (data == null) {
return;
}
keys = keys.split('.');
key = keys.pop();
data = deep_get(data, keys.join('.'));
return data != null ? data[key] = value : void 0;
};
functionify = function(callback, args) {
var method, methods;
if (typeof callback === 'function') {
return function() {
var moargs;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return callback.apply(this, args.concat(moargs));
};
}
if (isArray(callback)) {
methods = callback;
callback = function() {
var method, moargs, _i, _len, _ref, _ref1;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = methods.length; _i < _len; _i++) {
method = methods[_i];
_ref = isArray(method) ? method : [method], method = _ref[0], args = 2 <= _ref.length ? __slice.call(_ref, 1) : [];
if ((_ref1 = this[method]) != null) {
_ref1.apply(this, args.concat(moargs));
}
}
};
callback.method = methods;
} else {
method = callback;
callback = function() {
var moargs, _ref;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (_ref = this[method]) != null ? _ref.apply(this, args.concat(moargs)) : void 0;
};
callback.method = method;
}
return callback;
};
multiplex = function(key, callback, args, action) {
var callbacks;
if (typeof key === 'object') {
callbacks = key;
return function() {
var _results;
_results = [];
for (key in callbacks) {
callback = callbacks[key];
callback = functionify(callback, args);
_results.push(action.call(this, key, callback.bind(this)));
}
return _results;
};
} else {
callback = functionify(callback, args);
return function() {
return action.call(this, key, callback.bind(this));
};
}
};
module.exports = {
deep_get: deep_get,
deep_set: deep_set,
functionify: functionify,
multiplex: multiplex
};
}).call(this);
});
;require('./binding');}).call(this);

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

!function(){var t=function(e,n){var r=t.resolve(e,n||"/"),i=t.modules[r];if(!i)throw new Error("Failed to resolve module "+e+", tried "+r);var o=i._cached?i._cached:i();return o};t.paths=[],t.modules={},t.extensions=[".js",".coffee"],t._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},t.resolve=function(){return function(e,n){function r(e){if(t.modules[e])return e;for(var n=0;n<t.extensions.length;n++){var r=t.extensions[n];if(t.modules[e+r])return e+r}}function i(e){e=e.replace(/\/+$/,"");var n=e+"/package.json";if(t.modules[n]){var i=t.modules[n](),o=i.browserify;if("object"==typeof o&&o.main){var s=r(l.resolve(e,o.main));if(s)return s}else if("string"==typeof o){var s=r(l.resolve(e,o));if(s)return s}else if(i.main){var s=r(l.resolve(e,i.main));if(s)return s}}return r(e+"/index")}function o(t,e){for(var n=s(e),o=0;o<n.length;o++){var l=n[o],a=r(l+"/"+t);if(a)return a;var u=i(l+"/"+t);if(u)return u}var a=r(t);return a?a:void 0}function s(t){var e;e="/"===t?[""]:l.normalize(t).split("/");for(var n=[],r=e.length-1;r>=0;r--)if("node_modules"!==e[r]){var i=e.slice(0,r+1).join("/")+"/node_modules";n.push(i)}return n}if(n||(n="/"),t._core[e])return e;var l=t.modules.path(),a=n||".";if(e.match(/^(?:\.\.?\/|\/)/)){var u=r(l.resolve(a,e))||i(l.resolve(a,e));if(u)return u}var c=o(e,a);if(c)return c;throw new Error("Cannot find module '"+e+"'")}}(),t.alias=function(n,r){var i=t.modules.path(),o=null;try{o=t.resolve(n+"/package.json","/")}catch(s){o=t.resolve(n,"/")}for(var l=i.dirname(o),a=e(t.modules),u=0;u<a.length;u++){var c=a[u];if(c.slice(0,l.length+1)===l+"/"){var h=c.slice(l.length);t.modules[r+h]=t.modules[l+h]}else c===l&&(t.modules[r]=t.modules[l])}},t.define=function(e,n){var r=t._core[e]?"":t.modules.path().dirname(e),i=function(e){return t(e,r)};i.resolve=function(e){return t.resolve(e,r)},i.modules=t.modules;var o={exports:{}};t.modules[e]=function(){return n.call(o.exports,i,o,o.exports,r,e),t.modules[e]._cached=o.exports,o.exports}};var e=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};"undefined"==typeof process&&(process={}),process.nextTick||(process.nextTick=function(t){setTimeout(t,0)}),process.title||(process.title="browser"),process.binding||(process.binding=function(e){if("evals"===e)return t("vm");throw new Error("No such module")}),process.cwd||(process.cwd=function(){return"."}),t.define("path",function(t,e,n){function r(t,e){for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}function i(t,e){for(var n=0,r=t.length;r>=0;r--){var i=t[r];"."==i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var o=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;n.resolve=function(){for(var t="",e=!1,n=arguments.length;n>=-1&&!e;n--){var o=n>=0?arguments[n]:process.cwd();"string"==typeof o&&o&&(t=o+"/"+t,e="/"===o.charAt(0))}return t=i(r(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."},n.normalize=function(t){var e="/"===t.charAt(0),n="/"===t.slice(-1);return t=i(r(t.split("/"),function(t){return!!t}),!e).join("/"),t||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t){return t&&"string"==typeof t}).join("/"))},n.dirname=function(t){var e=o.exec(t)[1]||"",n=!1;return e?1===e.length||n&&e.length<=3&&":"===e.charAt(1)?e:e.substring(0,e.length-1):"."},n.basename=function(t,e){var n=o.exec(t)[2]||"";return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},n.extname=function(t){return o.exec(t)[3]||""}}),t.define("/binding.js",function(t,e){!function(){var t,n,r,i,o,s,l,a=[].slice;l=Array.prototype.slice,o=Array.isArray,n=function(t,e){var n,r,i,o,s;if(null!=t){if(!e.length)return t;for(s=e.split("."),i=0,o=s.length;o>i&&(n=s[i],r=t[n],"function"==typeof r&&(r=r.call(t)),t=r,null!=t);i++);return t}},r=function(t,e,r){var i;if(null!=t)return e=e.split("."),i=e.pop(),t=n(t,e.join(".")),null!=t?t[i]=r:void 0},i=function(t,e){var n,r;return"function"==typeof t?function(){var n;return n=1<=arguments.length?a.call(arguments,0):[],t.apply(this,e.concat(n))}:(o(t)?(r=t,t=function(){var t,n,i,s,l,u;for(n=1<=arguments.length?a.call(arguments,0):[],i=0,s=r.length;s>i;i++)t=r[i],l=o(t)?t:[t],t=l[0],e=2<=l.length?a.call(l,1):[],null!=(u=this[t])&&u.apply(this,e.concat(n))},t.method=r):(n=t,t=function(){var t,r;return t=1<=arguments.length?a.call(arguments,0):[],null!=(r=this[n])?r.apply(this,e.concat(t)):void 0},t.method=n),t)},s=function(t,e,n,r){var o;return"object"==typeof t?(o=t,function(){var s;s=[];for(t in o)e=o[t],e=i(e,n),s.push(r.call(this,t,e.bind(this)));return s}):(e=i(e,n),function(){return r.call(this,t,e.bind(this))})},t=function(){function t(t){this.data=null!=t?t:{},this._binds={}}return t.prototype.bind=function(){var t,e,n,r;return n=arguments[0],e=arguments[1],t=3<=arguments.length?a.call(arguments,2):[],null==e&&(e="text"),r=this,s(n,e,t,function(t,e){var n;return(null!=(n=r._binds)[t]?(n=r._binds)[t]:n[t]=[]).push(e.bind(this)),e.call(this,r.get(t))})},t.prototype.unbind=function(t,e){var n,r,i,o,s,l;if(null!=e)for(n=null!=(l=this._binds[t])?l:[],i=o=0,s=n.length;s>o;i=++o)r=n[i],(e===r||r.method===e)&&n.splice(i,1);else delete this._binds[t];return this},t.prototype.trigger=function(t,e){var n,r,i,o,s,l,a;for(a=null!=(l=this._binds[t])?l:[],o=0,s=a.length;s>o;o++)n=a[o],n(e);if(e&&"object"==typeof e)for(r in e)i=e[r],this.trigger(""+t+"."+r,i);return this},t.prototype.set=function(t,e){var n;return n=r(this.data,t,e),null!=n&&this.trigger(t,e),e},t.prototype.get=function(t){return n(this.data,t)},t.prototype.change=function(t){var e,n;null==t&&(t={});for(e in t)n=t[e],this.set(e,n);return this},t}(),t.multiplex=s,t.Binding=t,e.exports=t}.call(this)}),t("./binding")}.call(this);
!function(){var t=function(e,n){var r=t.resolve(e,n||"/"),i=t.modules[r];if(!i)throw new Error("Failed to resolve module "+e+", tried "+r);var o=i._cached?i._cached:i();return o};t.paths=[],t.modules={},t.extensions=[".js",".coffee"],t._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},t.resolve=function(){return function(e,n){function r(e){if(t.modules[e])return e;for(var n=0;n<t.extensions.length;n++){var r=t.extensions[n];if(t.modules[e+r])return e+r}}function i(e){e=e.replace(/\/+$/,"");var n=e+"/package.json";if(t.modules[n]){var i=t.modules[n](),o=i.browserify;if("object"==typeof o&&o.main){var s=r(l.resolve(e,o.main));if(s)return s}else if("string"==typeof o){var s=r(l.resolve(e,o));if(s)return s}else if(i.main){var s=r(l.resolve(e,i.main));if(s)return s}}return r(e+"/index")}function o(t,e){for(var n=s(e),o=0;o<n.length;o++){var l=n[o],u=r(l+"/"+t);if(u)return u;var a=i(l+"/"+t);if(a)return a}var u=r(t);return u?u:void 0}function s(t){var e;e="/"===t?[""]:l.normalize(t).split("/");for(var n=[],r=e.length-1;r>=0;r--)if("node_modules"!==e[r]){var i=e.slice(0,r+1).join("/")+"/node_modules";n.push(i)}return n}if(n||(n="/"),t._core[e])return e;var l=t.modules.path(),u=n||".";if(e.match(/^(?:\.\.?\/|\/)/)){var a=r(l.resolve(u,e))||i(l.resolve(u,e));if(a)return a}var c=o(e,u);if(c)return c;throw new Error("Cannot find module '"+e+"'")}}(),t.alias=function(n,r){var i=t.modules.path(),o=null;try{o=t.resolve(n+"/package.json","/")}catch(s){o=t.resolve(n,"/")}for(var l=i.dirname(o),u=e(t.modules),a=0;a<u.length;a++){var c=u[a];if(c.slice(0,l.length+1)===l+"/"){var f=c.slice(l.length);t.modules[r+f]=t.modules[l+f]}else c===l&&(t.modules[r]=t.modules[l])}},t.define=function(e,n){var r=t._core[e]?"":t.modules.path().dirname(e),i=function(e){return t(e,r)};i.resolve=function(e){return t.resolve(e,r)},i.modules=t.modules;var o={exports:{}};t.modules[e]=function(){return n.call(o.exports,i,o,o.exports,r,e),t.modules[e]._cached=o.exports,o.exports}};var e=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};"undefined"==typeof process&&(process={}),process.nextTick||(process.nextTick=function(t){setTimeout(t,0)}),process.title||(process.title="browser"),process.binding||(process.binding=function(e){if("evals"===e)return t("vm");throw new Error("No such module")}),process.cwd||(process.cwd=function(){return"."}),t.define("path",function(t,e,n){function r(t,e){for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}function i(t,e){for(var n=0,r=t.length;r>=0;r--){var i=t[r];"."==i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var o=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;n.resolve=function(){for(var t="",e=!1,n=arguments.length;n>=-1&&!e;n--){var o=n>=0?arguments[n]:process.cwd();"string"==typeof o&&o&&(t=o+"/"+t,e="/"===o.charAt(0))}return t=i(r(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."},n.normalize=function(t){var e="/"===t.charAt(0),n="/"===t.slice(-1);return t=i(r(t.split("/"),function(t){return!!t}),!e).join("/"),t||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t){return t&&"string"==typeof t}).join("/"))},n.dirname=function(t){var e=o.exec(t)[1]||"",n=!1;return e?1===e.length||n&&e.length<=3&&":"===e.charAt(1)?e:e.substring(0,e.length-1):"."},n.basename=function(t,e){var n=o.exec(t)[2]||"";return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},n.extname=function(t){return o.exec(t)[3]||""}}),t.define("/binding.js",function(t,e){!function(){var n,r,i,o,s,l=[].slice;s=t("./util"),r=s.deep_get,i=s.deep_set,o=s.multiplex,n=function(){function t(t){this.data=null!=t?t:{},this._binds={}}return t.prototype.bind=function(){var t,e,n,r;return n=arguments[0],e=arguments[1],t=3<=arguments.length?l.call(arguments,2):[],null==e&&(e="text"),r=this,o(n,e,t,function(t,e){var n;return(null!=(n=r._binds)[t]?(n=r._binds)[t]:n[t]=[]).push(e.bind(this)),e.call(this,r.get(t))})},t.prototype.unbind=function(t,e){var n,r,i,o,s,l;if(null!=e)for(n=null!=(l=this._binds[t])?l:[],i=o=0,s=n.length;s>o;i=++o)r=n[i],(e===r||r.method===e)&&n.splice(i,1);else delete this._binds[t];return this},t.prototype.trigger=function(t,e){var n,r,i,o,s,l,u;for(u=null!=(l=this._binds[t])?l:[],o=0,s=u.length;s>o;o++)n=u[o],n(e);if(e&&"object"==typeof e)for(r in e)i=e[r],this.trigger(""+t+"."+r,i);return this},t.prototype.set=function(t,e){var n;return n=i(this.data,t,e),null!=n&&this.trigger(t,e),e},t.prototype.get=function(t){return r(this.data,t)},t.prototype.change=function(t){var e,n;null==t&&(t={});for(e in t)n=t[e],this.set(e,n);return this},t}(),n.Binding=n,e.exports=n}.call(this)}),t.define("/util.js",function(t,e){!function(){var t,n,r,i,o,s=[].slice;i=Array.isArray,t=function(t,e){var n,r,i,o,s;if(null!=t){if(!e.length)return t;for(s=e.split("."),i=0,o=s.length;o>i&&(n=s[i],r=t[n],"function"==typeof r&&(r=r.call(t)),t=r,null!=t);i++);return t}},n=function(e,n,r){var i;if(null!=e)return n=n.split("."),i=n.pop(),e=t(e,n.join(".")),null!=e?e[i]=r:void 0},r=function(t,e){var n,r;return"function"==typeof t?function(){var n;return n=1<=arguments.length?s.call(arguments,0):[],t.apply(this,e.concat(n))}:(i(t)?(r=t,t=function(){var t,n,o,l,u,a;for(n=1<=arguments.length?s.call(arguments,0):[],o=0,l=r.length;l>o;o++)t=r[o],u=i(t)?t:[t],t=u[0],e=2<=u.length?s.call(u,1):[],null!=(a=this[t])&&a.apply(this,e.concat(n))},t.method=r):(n=t,t=function(){var t,r;return t=1<=arguments.length?s.call(arguments,0):[],null!=(r=this[n])?r.apply(this,e.concat(t)):void 0},t.method=n),t)},o=function(t,e,n,i){var o;return"object"==typeof t?(o=t,function(){var s;s=[];for(t in o)e=o[t],e=r(e,n),s.push(i.call(this,t,e.bind(this)));return s}):(e=r(e,n),function(){return i.call(this,t,e.bind(this))})},e.exports={deep_get:t,deep_set:n,functionify:r,multiplex:o}}.call(this)}),t("./binding")}.call(this);

@@ -321,3 +321,3 @@ ;(function(){var require = function (file, cwd) {

(function() {
var Binding, List, ListBinding, adiff, boundpartial, createBinding, deep_set, isArray, listadd, listpartial, listpartialize, listrm, listswitch, listsync, multiplex, slice, _ref,
var Binding, List, ListBinding, adiff, boundpartial, createBinding, deep_get, deep_set, isArray, listadd, listpartial, listpartialize, listrm, listswitch, listsync, multiplex, slice, _ref,
__slice = [].slice,

@@ -335,4 +335,6 @@ __hasProp = {}.hasOwnProperty,

_ref = require('./binding'), Binding = _ref.Binding, multiplex = _ref.multiplex;
Binding = require('./binding').Binding;
_ref = require('./util'), multiplex = _ref.multiplex, deep_get = _ref.deep_get;
adiff = adiff({

@@ -358,3 +360,3 @@ equal: function(a, b) {

boundpartial = function() {
var args, binding, create, partial, value;
var args, binding, create, el, partial, value, _ref1;
create = arguments[0], value = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];

@@ -366,4 +368,5 @@ binding = createBinding(value);

}
if (typeof binding === 'object') {
partial._bind = binding;
el = (_ref1 = partial.xml) != null ? _ref1 : partial;
if (typeof value === 'object') {
el._bind = binding;
}

@@ -484,3 +487,3 @@ return partial;

deep_set = function(items, data, key, value) {
var binding, curdata, curkey, i, k, keys, last_key, next, restkeys, result, _i, _len, _ref1;
var binding, curdata, curkey, i, index, k, keys, last_key, next, restkeys, result, _i, _len, _ref1;
keys = key.split('.');

@@ -499,8 +502,8 @@ last_key = keys.pop();

if (isArray(data)) {
i = keys.pop();
restkeys = keys.slice(i + 1);
restkeys.push(last_key);
binding = (_ref1 = items[curkey][i]) != null ? _ref1._bind : void 0;
index = restkeys.shift();
binding = (_ref1 = items[curkey][index]) != null ? _ref1._bind : void 0;
if (restkeys.length === 0) {
curdata[k][i] = value;
curdata[k][index] = value;
result = binding != null ? binding.change(value) : void 0;

@@ -538,2 +541,15 @@ } else {

ListBinding.prototype.unbind = function(key) {
if (this.items[key] != null) {
delete this.items[key];
}
if (this.values[key] != null) {
delete this.values[key];
}
if (this.partials[key] != null) {
delete this.partials[key];
}
return ListBinding.__super__.unbind.apply(this, arguments);
};
ListBinding.prototype.repeat = function() {

@@ -560,13 +576,17 @@ var args, callback, items, key, old, that;

ListBinding.prototype.unbind = function(key) {
if (this.items[key] != null) {
delete this.items[key];
ListBinding.prototype.each = function() {
var args, callback, key, that;
key = arguments[0], callback = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
if (callback == null) {
callback = 'text';
}
if (this.values[key] != null) {
delete this.values[key];
}
if (this.partials[key] != null) {
delete this.partials[key];
}
return ListBinding.__super__.unbind.apply(this, arguments);
that = this;
return multiplex(key, callback, args, function(key, callback) {
var _ref1;
return (_ref1 = that.items[key]) != null ? _ref1.forEach(function(item, i) {
if ((item != null ? item._bind : void 0) != null) {
return callback(item._bind, i);
}
}) : void 0;
})();
};

@@ -583,7 +603,26 @@

ListBinding.prototype.indexOf = function(key, subkey, value) {
var data, i, _i, _len, _ref1, _ref2;
_ref2 = (_ref1 = this.get(key)) != null ? _ref1 : [];
for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) {
data = _ref2[i];
if (deep_get(data, subkey) === value) {
return i;
}
}
return -1;
};
ListBinding.prototype.addTo = function(key, value) {
var _base, _ref1;
if ((_ref1 = this.get(key)) != null) {
if (typeof _ref1.push === "function") {
_ref1.push(value);
var binding, i, restkeys, subkey, _base, _ref1, _ref2;
if (/\.\d+\./.test(key)) {
subkey = key.split(/\.\d+\./, 1)[0];
restkeys = key.substr(subkey.length + 1).split('.');
i = restkeys.shift();
binding = (_ref1 = this.items[subkey][i]) != null ? _ref1._bind : void 0;
return binding != null ? binding.addTo(restkeys.join('.'), value) : void 0;
}
if ((_ref2 = this.get(key)) != null) {
if (typeof _ref2.push === "function") {
_ref2.push(value);
}

@@ -942,3 +981,3 @@ }

require.define("/node_modules/dt-list/package.json", function (require, module, exports, __dirname, __filename) {
module.exports = {"name":"dt-list","description":"Δt list controller - async & dynamic templating engine","version":"0.1.3","homepage":"https://github.com/dodo/node-dt-list","author":"dodo (https://github.com/dodo)","repository":{"type":"git","url":"git://github.com/dodo/node-dt-list.git"},"main":"dt-list.js","engines":{"node":">= 0.4.x"},"keywords":["dt","async","dynamic","event","template","stream","browser","list","order"],"scripts":{"prepublish":"cake build"},"dependencies":{"order":">= 0.1.0"},"devDependencies":{"browserify":"1.6.1","scopify":">= 0.2.1","muffin":">= 0.2.6","coffee-script":">= 1.1.3"},"licenses":[{"type":"MIT","url":"http://github.com/dodo/node-dynamictemplate/raw/master/LICENSE"}]}
module.exports = {"name":"dt-list","description":"Δt list controller - async & dynamic templating engine","version":"0.1.4","homepage":"https://github.com/dodo/node-dt-list","author":"dodo (https://github.com/dodo)","repository":{"type":"git","url":"git://github.com/dodo/node-dt-list.git"},"main":"dt-list.js","engines":{"node":">= 0.4.x"},"keywords":["dt","async","dynamic","event","template","stream","browser","list","order"],"scripts":{"prepublish":"cake build"},"dependencies":{"order":">= 0.1.0"},"peerDependencies":{"dynamictemplate":">= 0.7.1"},"devDependencies":{"browserify":"1.6.1","scopify":">= 0.2.1","muffin":">= 0.2.6","coffee-script":">= 1.1.3"},"licenses":[{"type":"MIT","url":"http://github.com/dodo/node-dynamictemplate/raw/master/LICENSE"}]}
});

@@ -962,8 +1001,16 @@

mark = function(el) {
var _ref, _ref1, _ref2, _ref3;
if (List.warn && (el.builder != null) && (((_ref = el.builder.adapters) != null ? (_ref1 = _ref.browser) != null ? (_ref2 = _ref1.plugins) != null ? _ref2.list : void 0 : void 0 : void 0) == null)) {
console.warn("dt-list adapter plugin is missing!");
List.warn = false;
var _ref;
el = (_ref = el.xml) != null ? _ref : el;
if (List.warn) {
el.once('added', function() {
var root, _ref1, _ref2, _ref3;
root = el.root();
if (List.warn && (root.builder != null)) {
if (((_ref1 = root.builder.adapters) != null ? (_ref2 = _ref1.browser) != null ? (_ref3 = _ref2.plugins) != null ? _ref3.list : void 0 : void 0 : void 0) == null) {
console.warn("dt-list adapter plugin is missing!");
}
return List.warn = false;
}
});
}
el = (_ref3 = el.xml) != null ? _ref3 : el;
return function(done) {

@@ -1299,101 +1346,7 @@ el._list_ready = done;

(function() {
var Binding, deep_get, deep_set, functionify, isArray, multiplex, slice,
var Binding, deep_get, deep_set, multiplex, _ref,
__slice = [].slice;
slice = Array.prototype.slice;
_ref = require('./util'), deep_get = _ref.deep_get, deep_set = _ref.deep_set, multiplex = _ref.multiplex;
isArray = Array.isArray;
deep_get = function(data, keys) {
var key, next, _i, _len, _ref;
if (data == null) {
return;
}
if (!keys.length) {
return data;
}
_ref = keys.split('.');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
next = data[key];
if (typeof next === 'function') {
next = next.call(data);
}
data = next;
if (data == null) {
break;
}
}
return data;
};
deep_set = function(data, keys, value) {
var key;
if (data == null) {
return;
}
keys = keys.split('.');
key = keys.pop();
data = deep_get(data, keys.join('.'));
return data != null ? data[key] = value : void 0;
};
functionify = function(callback, args) {
var method, methods;
if (typeof callback !== 'function') {
if (isArray(callback)) {
methods = callback;
callback = function() {
var method, moargs, _i, _len, _ref, _ref1;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = methods.length; _i < _len; _i++) {
method = methods[_i];
_ref = isArray(method) ? method : [method], method = _ref[0], args = 2 <= _ref.length ? __slice.call(_ref, 1) : [];
if ((_ref1 = this[method]) != null) {
_ref1.apply(this, args.concat(moargs));
}
}
};
callback.method = methods;
} else {
method = callback;
callback = function() {
var moargs, _ref;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (_ref = this[method]) != null ? _ref.apply(this, args.concat(moargs)) : void 0;
};
callback.method = method;
}
} else {
return function() {
var moargs;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return callback.apply(this, args.concat(moargs));
};
}
return callback;
};
multiplex = function(key, callback, args, action) {
var callbacks;
if (typeof key === 'object') {
callbacks = key;
return function() {
var _results;
_results = [];
for (key in callbacks) {
callback = callbacks[key];
callback = functionify(callback, args);
_results.push(action.call(this, key, callback.bind(this)));
}
return _results;
};
} else {
callback = functionify(callback, args);
return function() {
return action.call(this, key, callback.bind(this));
};
}
};
Binding = (function() {

@@ -1420,5 +1373,5 @@ function Binding(data) {

Binding.prototype.unbind = function(key, callback) {
var callbacks, fun, i, _i, _len, _ref;
var callbacks, fun, i, _i, _len, _ref1;
if (callback != null) {
callbacks = (_ref = this._binds[key]) != null ? _ref : [];
callbacks = (_ref1 = this._binds[key]) != null ? _ref1 : [];
for (i = _i = 0, _len = callbacks.length; _i < _len; i = ++_i) {

@@ -1437,6 +1390,6 @@ fun = callbacks[i];

Binding.prototype.trigger = function(key, value) {
var callback, subkey, subval, _i, _len, _ref, _ref1;
_ref1 = (_ref = this._binds[key]) != null ? _ref : [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
callback = _ref1[_i];
var callback, subkey, subval, _i, _len, _ref1, _ref2;
_ref2 = (_ref1 = this._binds[key]) != null ? _ref1 : [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
callback = _ref2[_i];
callback(value);

@@ -1482,4 +1435,2 @@ }

Binding.multiplex = multiplex;
Binding.Binding = Binding;

@@ -1492,2 +1443,111 @@

});
require.define("/util.js", function (require, module, exports, __dirname, __filename) {
(function() {
var deep_get, deep_set, functionify, isArray, multiplex,
__slice = [].slice;
isArray = Array.isArray;
deep_get = function(data, keys) {
var key, next, _i, _len, _ref;
if (data == null) {
return;
}
if (!keys.length) {
return data;
}
_ref = keys.split('.');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
next = data[key];
if (typeof next === 'function') {
next = next.call(data);
}
data = next;
if (data == null) {
break;
}
}
return data;
};
deep_set = function(data, keys, value) {
var key;
if (data == null) {
return;
}
keys = keys.split('.');
key = keys.pop();
data = deep_get(data, keys.join('.'));
return data != null ? data[key] = value : void 0;
};
functionify = function(callback, args) {
var method, methods;
if (typeof callback === 'function') {
return function() {
var moargs;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return callback.apply(this, args.concat(moargs));
};
}
if (isArray(callback)) {
methods = callback;
callback = function() {
var method, moargs, _i, _len, _ref, _ref1;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = methods.length; _i < _len; _i++) {
method = methods[_i];
_ref = isArray(method) ? method : [method], method = _ref[0], args = 2 <= _ref.length ? __slice.call(_ref, 1) : [];
if ((_ref1 = this[method]) != null) {
_ref1.apply(this, args.concat(moargs));
}
}
};
callback.method = methods;
} else {
method = callback;
callback = function() {
var moargs, _ref;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (_ref = this[method]) != null ? _ref.apply(this, args.concat(moargs)) : void 0;
};
callback.method = method;
}
return callback;
};
multiplex = function(key, callback, args, action) {
var callbacks;
if (typeof key === 'object') {
callbacks = key;
return function() {
var _results;
_results = [];
for (key in callbacks) {
callback = callbacks[key];
callback = functionify(callback, args);
_results.push(action.call(this, key, callback.bind(this)));
}
return _results;
};
} else {
callback = functionify(callback, args);
return function() {
return action.call(this, key, callback.bind(this));
};
}
};
module.exports = {
deep_get: deep_get,
deep_set: deep_set,
functionify: functionify,
multiplex: multiplex
};
}).call(this);
});
;require('./list');}).call(this);

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

!function(){var t=function(e,n){var r=t.resolve(e,n||"/"),i=t.modules[r];if(!i)throw new Error("Failed to resolve module "+e+", tried "+r);var s=i._cached?i._cached:i();return s};t.paths=[],t.modules={},t.extensions=[".js",".coffee"],t._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},t.resolve=function(){return function(e,n){function r(e){if(t.modules[e])return e;for(var n=0;n<t.extensions.length;n++){var r=t.extensions[n];if(t.modules[e+r])return e+r}}function i(e){e=e.replace(/\/+$/,"");var n=e+"/package.json";if(t.modules[n]){var i=t.modules[n](),s=i.browserify;if("object"==typeof s&&s.main){var o=r(l.resolve(e,s.main));if(o)return o}else if("string"==typeof s){var o=r(l.resolve(e,s));if(o)return o}else if(i.main){var o=r(l.resolve(e,i.main));if(o)return o}}return r(e+"/index")}function s(t,e){for(var n=o(e),s=0;s<n.length;s++){var l=n[s],a=r(l+"/"+t);if(a)return a;var u=i(l+"/"+t);if(u)return u}var a=r(t);return a?a:void 0}function o(t){var e;e="/"===t?[""]:l.normalize(t).split("/");for(var n=[],r=e.length-1;r>=0;r--)if("node_modules"!==e[r]){var i=e.slice(0,r+1).join("/")+"/node_modules";n.push(i)}return n}if(n||(n="/"),t._core[e])return e;var l=t.modules.path(),a=n||".";if(e.match(/^(?:\.\.?\/|\/)/)){var u=r(l.resolve(a,e))||i(l.resolve(a,e));if(u)return u}var c=s(e,a);if(c)return c;throw new Error("Cannot find module '"+e+"'")}}(),t.alias=function(n,r){var i=t.modules.path(),s=null;try{s=t.resolve(n+"/package.json","/")}catch(o){s=t.resolve(n,"/")}for(var l=i.dirname(s),a=e(t.modules),u=0;u<a.length;u++){var c=a[u];if(c.slice(0,l.length+1)===l+"/"){var h=c.slice(l.length);t.modules[r+h]=t.modules[l+h]}else c===l&&(t.modules[r]=t.modules[l])}},t.define=function(e,n){var r=t._core[e]?"":t.modules.path().dirname(e),i=function(e){return t(e,r)};i.resolve=function(e){return t.resolve(e,r)},i.modules=t.modules;var s={exports:{}};t.modules[e]=function(){return n.call(s.exports,i,s,s.exports,r,e),t.modules[e]._cached=s.exports,s.exports}};var e=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};"undefined"==typeof process&&(process={}),process.nextTick||(process.nextTick=function(t){setTimeout(t,0)}),process.title||(process.title="browser"),process.binding||(process.binding=function(e){if("evals"===e)return t("vm");throw new Error("No such module")}),process.cwd||(process.cwd=function(){return"."}),t.define("path",function(t,e,n){function r(t,e){for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}function i(t,e){for(var n=0,r=t.length;r>=0;r--){var i=t[r];"."==i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var s=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;n.resolve=function(){for(var t="",e=!1,n=arguments.length;n>=-1&&!e;n--){var s=n>=0?arguments[n]:process.cwd();"string"==typeof s&&s&&(t=s+"/"+t,e="/"===s.charAt(0))}return t=i(r(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."},n.normalize=function(t){var e="/"===t.charAt(0),n="/"===t.slice(-1);return t=i(r(t.split("/"),function(t){return!!t}),!e).join("/"),t||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t){return t&&"string"==typeof t}).join("/"))},n.dirname=function(t){var e=s.exec(t)[1]||"",n=!1;return e?1===e.length||n&&e.length<=3&&":"===e.charAt(1)?e:e.substring(0,e.length-1):"."},n.basename=function(t,e){var n=s.exec(t)[2]||"";return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},n.extname=function(t){return s.exec(t)[3]||""}}),t.define("/list.js",function(t,e){!function(){var n,r,i,s,o,l,a,u,c,h,f,p,d,g,m,v,y,_=[].slice,b={}.hasOwnProperty,w=function(t,e){function n(){this.constructor=t}for(var r in e)b.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};s=t("adiff"),r=t("dt-list").List,v=Array.prototype.slice,u=Array.isArray,y=t("./binding"),n=y.Binding,m=y.multiplex,s=s({equal:function(t,e){return t&&!e?!1:u(t)&&t.length!==e.length?!1:t===e}},s),l=function(t){return t&&"object"==typeof t?new i(t):t},o=function(){var t,e,n,r,i;return n=arguments[0],i=arguments[1],t=3<=arguments.length?_.call(arguments,2):[],e=l(i),r=n.apply(null,[e].concat(_.call(t))),null==r&&n(new Error("partial or element missing!")),"object"==typeof e&&(r._bind=e),r},c=function(t,e,n,r){var i,s,l,a,u,c;for(i=[],s=u=0,c=r.length;c>u;s=++u)a=r[s],l=o(e,a,s),i.push(l),t.push(l);return n.value=v.call(r),[i,[],[]]},p=function(t,e){var n,r,i;for(r=[];t.length;)n=null!=(i=t.pop())?i.remove({soft:!1}):void 0,null!=n&&r.push(n);return e.value=[],[[],[],r]},g=function(t,e,n,r){var i,l,a,u,c,h,f,p,d,g,m,y,_,b,w,k,x,j,A,O,C;for(j=[[],[],[]],i=j[0],l=j[1],m=j[2],p=v.call(t),A=s.diff(n.value,r),y=0,k=A.length;k>y;y++){for(d=A[y],c=d[0],a=d[1],u=_=c,O=c+a;O>=c?O>_:_>O;u=O>=c?++_:--_)-1===l.indexOf(t[u])&&m.push(t[u]);for(f=b=2,C=d.length;C>=2?C>b:b>C;f=C>=2?++b:--b)u=n.value.indexOf(d[f]),-1===u?(d[f]=o(e,d[f],c+f-2),i.push(d[f])):(d[f]=p[u],l.push(p[u]),p[u].remove({soft:!0}),g=m.indexOf(p[u]),-1!==g&&m.splice(g,1));t.splice.apply(t,d)}for(w=0,x=m.length;x>w;w++)h=m[w],h.remove({soft:!1});return n.value=v.call(r),[i,l,m]},d=function(t,e,n,r){var i,s,o;return o=[n.value.length,r.length],s=o[0],i=o[1],s||i?s&&!i?p(t,n):!s&&i?c(t,e,n,r):g(t,e,n,r):[[],[],[]]},f=function(t,e,n,r){var i,s,o,l,a,u,c,h,f,p;for(null==r&&(r=[]),p=d(t,e,n,r),i=p[0],s=p[1],a=p[2],u=0,h=s.length;h>u;u++)o=s[u],this.add(o);for(c=0,f=i.length;f>c;c++)l=i[c],this.partial(l);return this},h=function(t,e,n,r){var i;return i=o(e,r,t.length),t.push(i),this.partial(i),n.value.push(r),i},a=function(t,e,n,r){var i,s,o,l,a,c,h,f,p,d,g,m,v;for(c=n.split("."),h=c.pop(),o="",l=g=0,m=c.length;m>g;l=++g){if(a=c[l],o+=(o&&"."||"")+a,s=e,f=e[a],"function"==typeof f&&(f=f.call(e)),e=f,u(e))return l=c.pop(),p=c.slice(l+1),p.push(h),i=null!=(v=t[o][l])?v._bind:void 0,0===p.length?(s[a][l]=r,d=null!=i?i.change(r):void 0):d=null!=i?i.set(p.join("."),r):void 0,{value:d,trigger:null!=i};if(null==e)break}return null!=e&&(e[h]=r),{value:r,trigger:null!=e}},i=function(t){function e(){this.items={},this.values={},this.partials={},e.__super__.constructor.apply(this,arguments)}return w(e,t),e.prototype.repeat=function(){var t,e,n,i,s,o;return i=arguments[0],e=arguments[1],t=3<=arguments.length?_.call(arguments,2):[],null==e&&(e="text"),o=this,s={value:[]},n=new r,m(i,e,t,function(t,e){var r;return o.items[t]=n,o.values[t]=s,o.partials[t]=h.bind(this,n,e,s),(null!=(r=o._binds)[t]?(r=o._binds)[t]:r[t]=[]).push(f.bind(this,n,e,s)),f.call(this,n,e,s,o.get(t))})},e.prototype.unbind=function(t){return null!=this.items[t]&&delete this.items[t],null!=this.values[t]&&delete this.values[t],null!=this.partials[t]&&delete this.partials[t],e.__super__.unbind.apply(this,arguments)},e.prototype.set=function(t,e){var n;return n=a(this.items,this.data,t,e),n.trigger&&this.trigger(t,n.value),n.value},e.prototype.addTo=function(t,e){var n,r;return null!=(r=this.get(t))&&"function"==typeof r.push&&r.push(e),"function"==typeof(n=this.partials)[t]?n[t](e):void 0},e.prototype.removeFrom=function(t,e){var n;if(null!=(n=this.values[t])?n.length:void 0)return null==e&&(e=this.values[t].value.length-1),this.get(t).splice(e,1),this.values[t].value.splice(e,1),delete this.items[e]._bind,this.items.remove(e)},e}(n),e.exports=i,i.Binding=i,i.ListBinding=i,i.listpartial=h,i.listsync=g,i.listadd=c,i.listrm=p,i.deep_set=a}.call(this)}),t.define("/node_modules/adiff/package.json",function(t,e){e.exports={author:{name:"Dominic Tarr",email:"dominic.tarr@gmail.com",url:"dominictarr.com"},name:"adiff",description:"diff and patch arrays.",version:"0.2.12",homepage:"https://github.com/dominictarr/adiff",repository:{type:"git",url:"git://github.com/dominictarr/adiff.git"},main:"./index.js",scripts:{test:"set -e; for t in test/*.js; do node $t; done"},devDependencies:{tape:"~2.3.0","es5-shim":"~2.1.0"},optionalDependencies:{},testling:{files:"test/*.js",browsers:["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},readme:'# adiff - Array diff tools is javacript\n\nadiff is a minimal implementation of diff tools, diff, patch, diff3 in javascript.\n\n[![testling badge](https://ci.testling.com/dominictarr/adiff.png)](https://ci.testling.com/dominictarr/adiff)\n\n[![build status](https://secure.travis-ci.org/dominictarr/adiff.png)](http://travis-ci.org/dominictarr/adiff)\n\nI initially started writing this to understand how git works. then i got totally carried away.\nadiff is a central component in [snob](http://github.com/dominictarr/snob) a self hosting port of git to javascript.\n\n## how git works.\n\nif you want to know what is the difference between two files, you must first know what is the same.\nthis is called the Longest Common Subsequence problem. if you have two sequences `x = "ABDCEF" and `y = "ABCXYZF"` then `LCS(x,y)` is clearly "ABCF".\n\n## lcs\n\n```\nfunction lcs (a,b)\n if head(a) == head(b)\n then lcs(a,b) = head(a) + lcs(tail(a), tail(b))\n else lcs(a, b) = max(lcs(tail(a),b), lcs(a, tail(b)))\n```\n\n(where max returns the longer list, head return the first element, and tail returns the rest of the sequence minus the head)\n\nthis is very simple, but with exponential time complexity.\nhowever, it can easily be made sufficantly performant by cacheing the return value of each call to lcs().\n\nsee js implementation, [index.js#L64-94](https://github.com/dominictarr/adiff/blob/master/index.js#L63-94)\n\n## chunking\n\nnow, we can see when the strings differ, by comparing them to the lcs. the next step is dividing them into \'stable\' chunks where they match the lcs, and unstable chunks where they differ.\n\nbasically, to go from `chunk("ABDCEF", "ABCXYZF")` to \n`["AB", ["D", ""], "C", ["E", "XYZ"], "F"]`\n\nnote that stable and unstable chunks always alternate.\n\nbasically, you iterate over the sequences and while the heads match the head of the lcs, shift that value to a stable chunk.\nthen, while the heads do not match the next head of the lcs,\ncollect add those items into an unstable chunk.\n\n## diff\n\nonce you have the chunks getting a list of changes that you can apply is easy...\n\nmaking a diff from a to b we want to know what changes to make to a to get b. \nthe way I have node this [Array#splice](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice)\nso, for `["AB", ["D", ""], "C", ["E", "XYZ"], "F"]`we want:\n\n``` js\n var changes = [\n [4, 1, \'X\', \'Y\', \'Z\'], //delete 1 item ("E") at index 4, then insert "X", "Y", "Z"\n [2, 1] //delete 1 item at index 2 ("D")\n ]\n``` \n\nnote, you can apply changes to the end of the array without altering the indexes in the start of the array.\n\nthis makes the function to apply the patch _very_ simple\n\n## patch\n\n``` js\n function patch (orig, changes) {\n var ary = orig.split(\'\') //assuming that orig is just a string\n changes.forEach(function (ch) {\n [].splice.apply(ary, ch)\n })\n return ary.join(\'\')\n }\n```\n\n## diff3\n \nif we want a _distributed_ version management system, the we need to be able to make changes in parallel.\nthis is only a slightly more complicated problem. given a string `"ABDCEF"`, If I changed it to `"ABCXYZF"`\nand meanwhile you changed it to "AXBCEFG". we must compare each of our changes to the original string, the [Concestor](http://en.wikipedia.org/wiki/Concestor)\n\n## merging rules\n\nTODO: worked example with chunks, resolve.\n\n## license\n\nMIT / Apache2\n',readmeFilename:"readme.markdown",bugs:{url:"https://github.com/dominictarr/adiff/issues"},dependencies:{},_id:"adiff@0.2.12",_from:"adiff@"}}),t.define("/node_modules/adiff/index.js",function(t,e,n){function r(t){return t[0]}function i(t){return t[t.length-1]}function s(t){return t.slice(1)}function o(t){return t.pop()}function l(t){return t.length}function a(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return!0;return!1}function u(t){return t.reduce(function(t,e){return t+e.length+e[1]+1},0)}function c(t,e){return u(t)<=u(e)?t:e}function h(t,e){if(t&&!e)return!1;if(Array.isArray(t)&&t.length!=e.length)return!1;if(t&&"object"==typeof t){for(var n in t)if(!h(t[n],e[n]))return!1;for(var n in e)if(!h(t[n],e[n]))return!1;return!0}return t==e}function f(t){return 1==t.length?t[0]:[].slice.call(t)}function p(t,e){function n(n){var i=-1;r=0;for(var s=n;s<t.length;s++)e(t[n],t[s])||(i=s,r++);return r>1?-1:i}var r,i=n(0);return-1!=i?i:(n(1),0==r?0:-1)}var n=e.exports=function(t,e){function n(t){d.length;for(var e in d){var n=d[e]&&d[e](t);if(n)return n}return t.splice(1,1),{"?":t}}var u=t&&t.equal||h;e=e||{},e.lcs=function g(){function t(t,e){return t.length+":"+e.length}function e(i,o){if(!i.length||!o.length)return[];if(n[t(i,o)])return n[t(i,o)];if(u(i[0],o[0]))return[r(i)].concat(e(s(i),s(o)));var l=e(s(i),o),a=e(i,s(o));return n[t(i,o)]=l.length>a.length?l:a}var n={},i=f(arguments),o=i[0],l=i[1];if(i.length>2)return i.push(g(i.shift(),i.shift())),g(i);for(var a=0,c=0,h=0;h<o.length&&h<l.length&&u(o[h],l[h]);h++)a=h+1;if(o.length===a)return o.slice();for(var h=0;h<o.length-a&&h<l.length-a&&u(o[o.length-1-h],l[l.length-1-h]);h++)c=h;var p=o.slice(a,o.length-c),d=l.slice(a,l.length-c);return o.slice(0,a).concat(e(p,d)).concat(o.slice(o.length-c))},e.chunk=function(t,n){function r(t){return t.length&&!s.length||!t.length&&s.length?!1:u(i(t),i(s))||0===t.length+s.length}for(var t=t.map(function(t){return t.slice()}),s=e.lcs.apply(null,t),c=[s].concat(t);a(t,l);){for(;t.every(r)&&t.every(l);)c.forEach(o);var h=!1,f=t.map(function(t){for(var e=[];!r(t);)e.unshift(o(t)),h=!0;return e});h&&n(t[0].length,f)}},e.optimisticDiff=function(t,e){for(var n=Math.max(t.length,e.length),r=Math.min(t.length,e.length),i=[],s=0;n>s;s++)if(t[s]!==e[s]){for(var o=[s],l=0;t[s]!==e[s]&&r>s;)o[1]=++l,o.push(e[s++]);s>=r&&(t.length>e.length?o[1]+=t.length-e.length:t.length<e.length&&(o=o.concat(e.slice(t.length)))),i.push(o)}return i},e.diff=function(t,n){var r=e.optimisticDiff(t,n),i=[];return e.chunk([t,n],function(t,e){var n=e.shift().length,r=e.shift();i.push([t,n].concat(r))}),c(r,i)},e.patch=function(t,e,n){return n!==!0&&(t=t.slice(t)),e.forEach(function(e){[].splice.apply(t,e)}),t},e.merge=function(){var t=f(arguments),n=e.diff3(t);return e.patch(t[0],n)},e.diff3=function(){var t=f(arguments),r=[];return e.chunk(t,function(t,e){var i=e[0],s=n(e);u(i,s)||r.push([t,i.length].concat(s))}),r},e.oddOneOut=function(t){t=t.slice(),t.unshift(t.splice(1,1)[0]);var e=p(t,u);return 0==e?t[1]:~e?t[e]:void 0},e.insertMergeOverDelete=function(t){t=t.slice(),t.splice(1,1);for(var e,n=0;n<t.length;n++)if(t[n].length){if(e)return;e=t[n]}return e};var d=t&&t.rules||[e.oddOneOut,e.insertMergeOverDelete];return e};n(null,n)}),t.define("/node_modules/dt-list/package.json",function(t,e){e.exports={name:"dt-list",description:"Δt list controller - async & dynamic templating engine",version:"0.1.3",homepage:"https://github.com/dodo/node-dt-list",author:"dodo (https://github.com/dodo)",repository:{type:"git",url:"git://github.com/dodo/node-dt-list.git"},main:"dt-list.js",engines:{node:">= 0.4.x"},keywords:["dt","async","dynamic","event","template","stream","browser","list","order"],scripts:{prepublish:"cake build"},dependencies:{order:">= 0.1.0"},devDependencies:{browserify:"1.6.1",scopify:">= 0.2.1",muffin:">= 0.2.6","coffee-script":">= 1.1.3"},licenses:[{type:"MIT",url:"http://github.com/dodo/node-dynamictemplate/raw/master/LICENSE"}]}}),t.define("/node_modules/dt-list/dt-list.js",function(t,e){e.exports=t("./lib/list")}),t.define("/node_modules/dt-list/lib/list.js",function(t,e){!function(){var n,r,i,s={}.hasOwnProperty,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l=[].slice;r=t("order").Order,i=function(t){var e,r,i,s;return n.warn&&null!=t.builder&&null==(null!=(e=t.builder.adapters)?null!=(r=e.browser)?null!=(i=r.plugins)?i.list:void 0:void 0:void 0)&&(console.warn("dt-list adapter plugin is missing!"),n.warn=!1),t=null!=(s=t.xml)?s:t,function(e){return t._list_ready=e,t}},n=function(t){function e(){e.__super__.constructor.call(this,function(t){var e,n,r;return r=t.idx,n=t.before,e=t.after,this[r]._list={idx:r,before:n,after:e,list:this}})}return o(e,t),e.prototype.push=function(t){return e.__super__.push.call(this,i(t))},e.prototype.unshift=function(t){return e.__super__.unshift.call(this,i(t))},e.prototype.insert=function(t,n){return e.__super__.insert.call(this,t,i(n))},e.prototype.splice=function(){var t,n,r,s;return s=arguments[0],t=arguments[1],r=3<=arguments.length?l.call(arguments,2):[],e.__super__.splice.apply(this,[s,t].concat(l.call(function(){var t,e,s;for(s=[],t=0,e=r.length;e>t;t++)n=r[t],s.push(i(n));return s}())))},e}(r),n.List=n,e.exports=n,n.warn=!0,"browser"===process.title&&function(){return null!=this.dynamictemplate?this.dynamictemplate.List=n:this.dynamictemplate={List:n}}.call(window)}.call(this)}),t.define("/node_modules/dt-list/node_modules/order/package.json",function(t,e){e.exports={name:"order",description:"handle ordered async lists",version:"0.1.0",homepage:"https://github.com/dodo/node-order",author:"dodo (https://github.com/dodo)",repository:{type:"git",url:"git://github.com/dodo/node-order.git"},main:"order.js",engines:{node:">= 0.4.x"},keywords:["order","list","array","collection","sequence","async","control","flow"],scripts:{test:"cake build && nodeunit test",prepublish:"cake build"},devDependencies:{nodeunit:">= 0.5.4",muffin:">= 0.2.6","coffee-script":">= 1.1.3"}}}),t.define("/node_modules/dt-list/node_modules/order/order.js",function(t,e){e.exports=t("./lib/order")}),t.define("/node_modules/dt-list/node_modules/order/lib/order.js",function(t,e){!function(){var t,n,r,i,s,o,l=[].slice,a={}.hasOwnProperty,u=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};o=Array.prototype.splice,r=function(t){return t._sync=!0,t},s=function(t,e){return"function"==typeof t._sync&&t._sync(),delete t._sync,e},n=function(t,e){return t._sync?t._sync=e:e()},i=function(){var t,e,r,i,s,o=this;if(s=arguments[0],e=2<=arguments.length?l.call(arguments,1):[],i=s.i,!isNaN(i)&&!this.done[i]){for(this.done[i]=!0,t=i+1;this.done[t]===!1;)t++;for(void 0===this.done[t]&&(t=-1),r=i-1;this.done[r]===!1;)r--;return void 0===this.done[r]&&(r=-1),n(this,function(){var n;return null!=(n=o.callback)?n.call.apply(n,[o,{idx:i,before:r,after:t}].concat(l.call(e))):void 0})}},t=function(t){function e(t){this.callback=t,this.keys=[],this.done=[],e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.push=function(t){var n;if(null!=t)return n={i:this.length},this.done.push(!1),this.keys.push(n),s(this,e.__super__.push.call(this,t(i.bind(r(this),n))))},e.prototype.unshift=function(t){var n,o,l,a,u;if(null!=t){for(o={i:0},u=this.keys,l=0,a=u.length;a>l;l++)n=u[l],n.i++;return this.done.unshift(!1),this.keys.unshift(o),s(this,e.__super__.unshift.call(this,t(i.bind(r(this),o))))}},e.prototype.pop=function(){var t;return null!=(t=this.keys[this.keys.length-1])&&(t.i=0/0),this.done.pop(),this.keys.pop(),e.__super__.pop.apply(this,arguments)},e.prototype.shift=function(){var t,n,r,i,s;for(null!=(i=this.keys[0])&&(i.i=0/0),this.done.shift(),this.keys.shift(),s=this.keys,n=0,r=s.length;r>n;n++)t=s[n],t.i--;return e.__super__.shift.apply(this,arguments)},e.prototype.insert=function(t,e){var n,l,a,u,c;if(null!=e){for(l={i:t},c=this.keys.slice(t),a=0,u=c.length;u>a;a++)n=c[a],n.i++;return this.keys.splice(t,0,l),this.done.splice(t,0,!1),s(this,o.call(this,t,0,e(i.bind(r(this),l))))}},e.prototype.remove=function(t){var e,n,r,i,s,l;for(null!=(i=this.keys[t])&&(i.i=0/0),this.done.splice(t,1),this.keys.splice(t,1),s=this.keys.slice(t),n=0,r=s.length;r>n;n++)e=s[n],e.i--;return null!=(l=o.call(this,t,1))?l[0]:void 0},e.prototype.splice=function(){var t,n,o,a,u,c,h,f,p,d,g,m,v,y,_,b,w,k,x,j,A,O,C,D;if(f=arguments[0],t=arguments[1],a=3<=arguments.length?l.call(arguments,2):[],null==f)return e.__super__.splice.apply(this,arguments);for(p=a.length,A=this.keys.slice(f,f+t),v=0,w=A.length;w>v;v++)o=A[v],o.i=0/0;for(h=function(){var t,e;for(e=[],c=t=0;p>=0?p>t:t>p;c=p>=0?++t:--t)e.push({i:c+f});return e}(),n=function(){var t,e;for(e=[],c=t=0;p>=0?p>t:t>p;c=p>=0?++t:--t)e.push(!1);return e}(),(O=this.done).splice.apply(O,[f,t].concat(l.call(n))),(C=this.keys).splice.apply(C,[f,t].concat(l.call(h))),D=this.keys.slice(f+p),y=0,k=D.length;k>y;y++)o=D[y],o.i=o.i-t+p;for(m=[],c=_=0,x=a.length;x>_;c=++_)u=a[c],r(this),a[c]=u(i.bind(this,h[c])),m.push(this._sync);for(r(this),d=e.__super__.splice.apply(this,[f,t].concat(l.call(a))),b=0,j=m.length;j>b;b++)g=m[b],"function"==typeof g&&g();return s(this),d},e}(Array),t.Order=t,e.exports=t}.call(this)}),t.define("/binding.js",function(t,e){!function(){var t,n,r,i,s,o,l,a=[].slice;l=Array.prototype.slice,s=Array.isArray,n=function(t,e){var n,r,i,s,o;if(null!=t){if(!e.length)return t;for(o=e.split("."),i=0,s=o.length;s>i&&(n=o[i],r=t[n],"function"==typeof r&&(r=r.call(t)),t=r,null!=t);i++);return t}},r=function(t,e,r){var i;if(null!=t)return e=e.split("."),i=e.pop(),t=n(t,e.join(".")),null!=t?t[i]=r:void 0},i=function(t,e){var n,r;return"function"==typeof t?function(){var n;return n=1<=arguments.length?a.call(arguments,0):[],t.apply(this,e.concat(n))}:(s(t)?(r=t,t=function(){var t,n,i,o,l,u;for(n=1<=arguments.length?a.call(arguments,0):[],i=0,o=r.length;o>i;i++)t=r[i],l=s(t)?t:[t],t=l[0],e=2<=l.length?a.call(l,1):[],null!=(u=this[t])&&u.apply(this,e.concat(n))},t.method=r):(n=t,t=function(){var t,r;return t=1<=arguments.length?a.call(arguments,0):[],null!=(r=this[n])?r.apply(this,e.concat(t)):void 0},t.method=n),t)},o=function(t,e,n,r){var s;return"object"==typeof t?(s=t,function(){var o;o=[];for(t in s)e=s[t],e=i(e,n),o.push(r.call(this,t,e.bind(this)));return o}):(e=i(e,n),function(){return r.call(this,t,e.bind(this))})},t=function(){function t(t){this.data=null!=t?t:{},this._binds={}}return t.prototype.bind=function(){var t,e,n,r;return n=arguments[0],e=arguments[1],t=3<=arguments.length?a.call(arguments,2):[],null==e&&(e="text"),r=this,o(n,e,t,function(t,e){var n;return(null!=(n=r._binds)[t]?(n=r._binds)[t]:n[t]=[]).push(e.bind(this)),e.call(this,r.get(t))})},t.prototype.unbind=function(t,e){var n,r,i,s,o,l;if(null!=e)for(n=null!=(l=this._binds[t])?l:[],i=s=0,o=n.length;o>s;i=++s)r=n[i],(e===r||r.method===e)&&n.splice(i,1);else delete this._binds[t];return this},t.prototype.trigger=function(t,e){var n,r,i,s,o,l,a;for(a=null!=(l=this._binds[t])?l:[],s=0,o=a.length;o>s;s++)n=a[s],n(e);if(e&&"object"==typeof e)for(r in e)i=e[r],this.trigger(""+t+"."+r,i);return this},t.prototype.set=function(t,e){var n;return n=r(this.data,t,e),null!=n&&this.trigger(t,e),e},t.prototype.get=function(t){return n(this.data,t)},t.prototype.change=function(t){var e,n;null==t&&(t={});for(e in t)n=t[e],this.set(e,n);return this},t}(),t.multiplex=o,t.Binding=t,e.exports=t}.call(this)}),t("./list")}.call(this);
!function(){var t=function(e,n){var r=t.resolve(e,n||"/"),i=t.modules[r];if(!i)throw new Error("Failed to resolve module "+e+", tried "+r);var s=i._cached?i._cached:i();return s};t.paths=[],t.modules={},t.extensions=[".js",".coffee"],t._core={assert:!0,events:!0,fs:!0,path:!0,vm:!0},t.resolve=function(){return function(e,n){function r(e){if(t.modules[e])return e;for(var n=0;n<t.extensions.length;n++){var r=t.extensions[n];if(t.modules[e+r])return e+r}}function i(e){e=e.replace(/\/+$/,"");var n=e+"/package.json";if(t.modules[n]){var i=t.modules[n](),s=i.browserify;if("object"==typeof s&&s.main){var o=r(l.resolve(e,s.main));if(o)return o}else if("string"==typeof s){var o=r(l.resolve(e,s));if(o)return o}else if(i.main){var o=r(l.resolve(e,i.main));if(o)return o}}return r(e+"/index")}function s(t,e){for(var n=o(e),s=0;s<n.length;s++){var l=n[s],a=r(l+"/"+t);if(a)return a;var u=i(l+"/"+t);if(u)return u}var a=r(t);return a?a:void 0}function o(t){var e;e="/"===t?[""]:l.normalize(t).split("/");for(var n=[],r=e.length-1;r>=0;r--)if("node_modules"!==e[r]){var i=e.slice(0,r+1).join("/")+"/node_modules";n.push(i)}return n}if(n||(n="/"),t._core[e])return e;var l=t.modules.path(),a=n||".";if(e.match(/^(?:\.\.?\/|\/)/)){var u=r(l.resolve(a,e))||i(l.resolve(a,e));if(u)return u}var c=s(e,a);if(c)return c;throw new Error("Cannot find module '"+e+"'")}}(),t.alias=function(n,r){var i=t.modules.path(),s=null;try{s=t.resolve(n+"/package.json","/")}catch(o){s=t.resolve(n,"/")}for(var l=i.dirname(s),a=e(t.modules),u=0;u<a.length;u++){var c=a[u];if(c.slice(0,l.length+1)===l+"/"){var h=c.slice(l.length);t.modules[r+h]=t.modules[l+h]}else c===l&&(t.modules[r]=t.modules[l])}},t.define=function(e,n){var r=t._core[e]?"":t.modules.path().dirname(e),i=function(e){return t(e,r)};i.resolve=function(e){return t.resolve(e,r)},i.modules=t.modules;var s={exports:{}};t.modules[e]=function(){return n.call(s.exports,i,s,s.exports,r,e),t.modules[e]._cached=s.exports,s.exports}};var e=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};"undefined"==typeof process&&(process={}),process.nextTick||(process.nextTick=function(t){setTimeout(t,0)}),process.title||(process.title="browser"),process.binding||(process.binding=function(e){if("evals"===e)return t("vm");throw new Error("No such module")}),process.cwd||(process.cwd=function(){return"."}),t.define("path",function(t,e,n){function r(t,e){for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}function i(t,e){for(var n=0,r=t.length;r>=0;r--){var i=t[r];"."==i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var s=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;n.resolve=function(){for(var t="",e=!1,n=arguments.length;n>=-1&&!e;n--){var s=n>=0?arguments[n]:process.cwd();"string"==typeof s&&s&&(t=s+"/"+t,e="/"===s.charAt(0))}return t=i(r(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."},n.normalize=function(t){var e="/"===t.charAt(0),n="/"===t.slice(-1);return t=i(r(t.split("/"),function(t){return!!t}),!e).join("/"),t||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t){return t&&"string"==typeof t}).join("/"))},n.dirname=function(t){var e=s.exec(t)[1]||"",n=!1;return e?1===e.length||n&&e.length<=3&&":"===e.charAt(1)?e:e.substring(0,e.length-1):"."},n.basename=function(t,e){var n=s.exec(t)[2]||"";return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},n.extname=function(t){return s.exec(t)[3]||""}}),t.define("/list.js",function(t,e){!function(){var n,r,i,s,o,l,a,u,c,h,f,p,d,g,m,v,y,_,b=[].slice,w={}.hasOwnProperty,x=function(t,e){function n(){this.constructor=t}for(var r in e)w.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};s=t("adiff"),r=t("dt-list").List,y=Array.prototype.slice,c=Array.isArray,n=t("./binding").Binding,_=t("./util"),v=_.multiplex,a=_.deep_get,s=s({equal:function(t,e){return t&&!e?!1:c(t)&&t.length!==e.length?!1:t===e}},s),l=function(t){return t&&"object"==typeof t?new i(t):t},o=function(){var t,e,n,r,i,s,o;return n=arguments[0],s=arguments[1],t=3<=arguments.length?b.call(arguments,2):[],e=l(s),i=n.apply(null,[e].concat(b.call(t))),null==i&&n(new Error("partial or element missing!")),r=null!=(o=i.xml)?o:i,"object"==typeof s&&(r._bind=e),i},h=function(t,e,n,r){var i,s,l,a,u,c;for(i=[],s=u=0,c=r.length;c>u;s=++u)a=r[s],l=o(e,a,s),i.push(l),t.push(l);return n.value=y.call(r),[i,[],[]]},d=function(t,e){var n,r,i;for(r=[];t.length;)n=null!=(i=t.pop())?i.remove({soft:!1}):void 0,null!=n&&r.push(n);return e.value=[],[[],[],r]},m=function(t,e,n,r){var i,l,a,u,c,h,f,p,d,g,m,v,_,b,w,x,k,j,A,O,D;for(j=[[],[],[]],i=j[0],l=j[1],m=j[2],p=y.call(t),A=s.diff(n.value,r),v=0,x=A.length;x>v;v++){for(d=A[v],c=d[0],a=d[1],u=_=c,O=c+a;O>=c?O>_:_>O;u=O>=c?++_:--_)-1===l.indexOf(t[u])&&m.push(t[u]);for(f=b=2,D=d.length;D>=2?D>b:b>D;f=D>=2?++b:--b)u=n.value.indexOf(d[f]),-1===u?(d[f]=o(e,d[f],c+f-2),i.push(d[f])):(d[f]=p[u],l.push(p[u]),p[u].remove({soft:!0}),g=m.indexOf(p[u]),-1!==g&&m.splice(g,1));t.splice.apply(t,d)}for(w=0,k=m.length;k>w;w++)h=m[w],h.remove({soft:!1});return n.value=y.call(r),[i,l,m]},g=function(t,e,n,r){var i,s,o;return o=[n.value.length,r.length],s=o[0],i=o[1],s||i?s&&!i?d(t,n):!s&&i?h(t,e,n,r):m(t,e,n,r):[[],[],[]]},p=function(t,e,n,r){var i,s,o,l,a,u,c,h,f,p;for(null==r&&(r=[]),p=g(t,e,n,r),i=p[0],s=p[1],a=p[2],u=0,h=s.length;h>u;u++)o=s[u],this.add(o);for(c=0,f=i.length;f>c;c++)l=i[c],this.partial(l);return this},f=function(t,e,n,r){var i;return i=o(e,r,t.length),t.push(i),this.partial(i),n.value.push(r),i},u=function(t,e,n,r){var i,s,o,l,a,u,h,f,p,d,g,m,v,y;for(h=n.split("."),f=h.pop(),o="",l=m=0,v=h.length;v>m;l=++m){if(u=h[l],o+=(o&&"."||"")+u,s=e,p=e[u],"function"==typeof p&&(p=p.call(e)),e=p,c(e))return d=h.slice(l+1),d.push(f),a=d.shift(),i=null!=(y=t[o][a])?y._bind:void 0,0===d.length?(s[u][a]=r,g=null!=i?i.change(r):void 0):g=null!=i?i.set(d.join("."),r):void 0,{value:g,trigger:null!=i};if(null==e)break}return null!=e&&(e[f]=r),{value:r,trigger:null!=e}},i=function(t){function e(){this.items={},this.values={},this.partials={},e.__super__.constructor.apply(this,arguments)}return x(e,t),e.prototype.unbind=function(t){return null!=this.items[t]&&delete this.items[t],null!=this.values[t]&&delete this.values[t],null!=this.partials[t]&&delete this.partials[t],e.__super__.unbind.apply(this,arguments)},e.prototype.repeat=function(){var t,e,n,i,s,o;return i=arguments[0],e=arguments[1],t=3<=arguments.length?b.call(arguments,2):[],null==e&&(e="text"),o=this,s={value:[]},n=new r,v(i,e,t,function(t,e){var r;return o.items[t]=n,o.values[t]=s,o.partials[t]=f.bind(this,n,e,s),(null!=(r=o._binds)[t]?(r=o._binds)[t]:r[t]=[]).push(p.bind(this,n,e,s)),p.call(this,n,e,s,o.get(t))})},e.prototype.each=function(){var t,e,n,r;return n=arguments[0],e=arguments[1],t=3<=arguments.length?b.call(arguments,2):[],null==e&&(e="text"),r=this,v(n,e,t,function(t,e){var n;return null!=(n=r.items[t])?n.forEach(function(t,n){return null!=(null!=t?t._bind:void 0)?e(t._bind,n):void 0}):void 0})()},e.prototype.set=function(t,e){var n;return n=u(this.items,this.data,t,e),n.trigger&&this.trigger(t,n.value),n.value},e.prototype.indexOf=function(t,e,n){var r,i,s,o,l,u;for(u=null!=(l=this.get(t))?l:[],i=s=0,o=u.length;o>s;i=++s)if(r=u[i],a(r,e)===n)return i;return-1},e.prototype.addTo=function(t,e){var n,r,i,s,o,l,a;return/\.\d+\./.test(t)?(s=t.split(/\.\d+\./,1)[0],i=t.substr(s.length+1).split("."),r=i.shift(),n=null!=(l=this.items[s][r])?l._bind:void 0,null!=n?n.addTo(i.join("."),e):void 0):(null!=(a=this.get(t))&&"function"==typeof a.push&&a.push(e),"function"==typeof(o=this.partials)[t]?o[t](e):void 0)},e.prototype.removeFrom=function(t,e){var n;if(null!=(n=this.values[t])?n.length:void 0)return null==e&&(e=this.values[t].value.length-1),this.get(t).splice(e,1),this.values[t].value.splice(e,1),delete this.items[e]._bind,this.items.remove(e)},e}(n),e.exports=i,i.Binding=i,i.ListBinding=i,i.listpartial=f,i.listsync=m,i.listadd=h,i.listrm=d,i.deep_set=u}.call(this)}),t.define("/node_modules/adiff/package.json",function(t,e){e.exports={author:{name:"Dominic Tarr",email:"dominic.tarr@gmail.com",url:"dominictarr.com"},name:"adiff",description:"diff and patch arrays.",version:"0.2.12",homepage:"https://github.com/dominictarr/adiff",repository:{type:"git",url:"git://github.com/dominictarr/adiff.git"},main:"./index.js",scripts:{test:"set -e; for t in test/*.js; do node $t; done"},devDependencies:{tape:"~2.3.0","es5-shim":"~2.1.0"},optionalDependencies:{},testling:{files:"test/*.js",browsers:["ie/8..latest","firefox/17..latest","firefox/nightly","chrome/22..latest","chrome/canary","opera/12..latest","opera/next","safari/5.1..latest","ipad/6.0..latest","iphone/6.0..latest","android-browser/4.2..latest"]},readme:'# adiff - Array diff tools is javacript\n\nadiff is a minimal implementation of diff tools, diff, patch, diff3 in javascript.\n\n[![testling badge](https://ci.testling.com/dominictarr/adiff.png)](https://ci.testling.com/dominictarr/adiff)\n\n[![build status](https://secure.travis-ci.org/dominictarr/adiff.png)](http://travis-ci.org/dominictarr/adiff)\n\nI initially started writing this to understand how git works. then i got totally carried away.\nadiff is a central component in [snob](http://github.com/dominictarr/snob) a self hosting port of git to javascript.\n\n## how git works.\n\nif you want to know what is the difference between two files, you must first know what is the same.\nthis is called the Longest Common Subsequence problem. if you have two sequences `x = "ABDCEF" and `y = "ABCXYZF"` then `LCS(x,y)` is clearly "ABCF".\n\n## lcs\n\n```\nfunction lcs (a,b)\n if head(a) == head(b)\n then lcs(a,b) = head(a) + lcs(tail(a), tail(b))\n else lcs(a, b) = max(lcs(tail(a),b), lcs(a, tail(b)))\n```\n\n(where max returns the longer list, head return the first element, and tail returns the rest of the sequence minus the head)\n\nthis is very simple, but with exponential time complexity.\nhowever, it can easily be made sufficantly performant by cacheing the return value of each call to lcs().\n\nsee js implementation, [index.js#L64-94](https://github.com/dominictarr/adiff/blob/master/index.js#L63-94)\n\n## chunking\n\nnow, we can see when the strings differ, by comparing them to the lcs. the next step is dividing them into \'stable\' chunks where they match the lcs, and unstable chunks where they differ.\n\nbasically, to go from `chunk("ABDCEF", "ABCXYZF")` to \n`["AB", ["D", ""], "C", ["E", "XYZ"], "F"]`\n\nnote that stable and unstable chunks always alternate.\n\nbasically, you iterate over the sequences and while the heads match the head of the lcs, shift that value to a stable chunk.\nthen, while the heads do not match the next head of the lcs,\ncollect add those items into an unstable chunk.\n\n## diff\n\nonce you have the chunks getting a list of changes that you can apply is easy...\n\nmaking a diff from a to b we want to know what changes to make to a to get b. \nthe way I have node this [Array#splice](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice)\nso, for `["AB", ["D", ""], "C", ["E", "XYZ"], "F"]`we want:\n\n``` js\n var changes = [\n [4, 1, \'X\', \'Y\', \'Z\'], //delete 1 item ("E") at index 4, then insert "X", "Y", "Z"\n [2, 1] //delete 1 item at index 2 ("D")\n ]\n``` \n\nnote, you can apply changes to the end of the array without altering the indexes in the start of the array.\n\nthis makes the function to apply the patch _very_ simple\n\n## patch\n\n``` js\n function patch (orig, changes) {\n var ary = orig.split(\'\') //assuming that orig is just a string\n changes.forEach(function (ch) {\n [].splice.apply(ary, ch)\n })\n return ary.join(\'\')\n }\n```\n\n## diff3\n \nif we want a _distributed_ version management system, the we need to be able to make changes in parallel.\nthis is only a slightly more complicated problem. given a string `"ABDCEF"`, If I changed it to `"ABCXYZF"`\nand meanwhile you changed it to "AXBCEFG". we must compare each of our changes to the original string, the [Concestor](http://en.wikipedia.org/wiki/Concestor)\n\n## merging rules\n\nTODO: worked example with chunks, resolve.\n\n## license\n\nMIT / Apache2\n',readmeFilename:"readme.markdown",bugs:{url:"https://github.com/dominictarr/adiff/issues"},dependencies:{},_id:"adiff@0.2.12",_from:"adiff@"}}),t.define("/node_modules/adiff/index.js",function(t,e,n){function r(t){return t[0]}function i(t){return t[t.length-1]}function s(t){return t.slice(1)}function o(t){return t.pop()}function l(t){return t.length}function a(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return!0;return!1}function u(t){return t.reduce(function(t,e){return t+e.length+e[1]+1},0)}function c(t,e){return u(t)<=u(e)?t:e}function h(t,e){if(t&&!e)return!1;if(Array.isArray(t)&&t.length!=e.length)return!1;if(t&&"object"==typeof t){for(var n in t)if(!h(t[n],e[n]))return!1;for(var n in e)if(!h(t[n],e[n]))return!1;return!0}return t==e}function f(t){return 1==t.length?t[0]:[].slice.call(t)}function p(t,e){function n(n){var i=-1;r=0;for(var s=n;s<t.length;s++)e(t[n],t[s])||(i=s,r++);return r>1?-1:i}var r,i=n(0);return-1!=i?i:(n(1),0==r?0:-1)}var n=e.exports=function(t,e){function n(t){d.length;for(var e in d){var n=d[e]&&d[e](t);if(n)return n}return t.splice(1,1),{"?":t}}var u=t&&t.equal||h;e=e||{},e.lcs=function g(){function t(t,e){return t.length+":"+e.length}function e(i,o){if(!i.length||!o.length)return[];if(n[t(i,o)])return n[t(i,o)];if(u(i[0],o[0]))return[r(i)].concat(e(s(i),s(o)));var l=e(s(i),o),a=e(i,s(o));return n[t(i,o)]=l.length>a.length?l:a}var n={},i=f(arguments),o=i[0],l=i[1];if(i.length>2)return i.push(g(i.shift(),i.shift())),g(i);for(var a=0,c=0,h=0;h<o.length&&h<l.length&&u(o[h],l[h]);h++)a=h+1;if(o.length===a)return o.slice();for(var h=0;h<o.length-a&&h<l.length-a&&u(o[o.length-1-h],l[l.length-1-h]);h++)c=h;var p=o.slice(a,o.length-c),d=l.slice(a,l.length-c);return o.slice(0,a).concat(e(p,d)).concat(o.slice(o.length-c))},e.chunk=function(t,n){function r(t){return t.length&&!s.length||!t.length&&s.length?!1:u(i(t),i(s))||0===t.length+s.length}for(var t=t.map(function(t){return t.slice()}),s=e.lcs.apply(null,t),c=[s].concat(t);a(t,l);){for(;t.every(r)&&t.every(l);)c.forEach(o);var h=!1,f=t.map(function(t){for(var e=[];!r(t);)e.unshift(o(t)),h=!0;return e});h&&n(t[0].length,f)}},e.optimisticDiff=function(t,e){for(var n=Math.max(t.length,e.length),r=Math.min(t.length,e.length),i=[],s=0;n>s;s++)if(t[s]!==e[s]){for(var o=[s],l=0;t[s]!==e[s]&&r>s;)o[1]=++l,o.push(e[s++]);s>=r&&(t.length>e.length?o[1]+=t.length-e.length:t.length<e.length&&(o=o.concat(e.slice(t.length)))),i.push(o)}return i},e.diff=function(t,n){var r=e.optimisticDiff(t,n),i=[];return e.chunk([t,n],function(t,e){var n=e.shift().length,r=e.shift();i.push([t,n].concat(r))}),c(r,i)},e.patch=function(t,e,n){return n!==!0&&(t=t.slice(t)),e.forEach(function(e){[].splice.apply(t,e)}),t},e.merge=function(){var t=f(arguments),n=e.diff3(t);return e.patch(t[0],n)},e.diff3=function(){var t=f(arguments),r=[];return e.chunk(t,function(t,e){var i=e[0],s=n(e);u(i,s)||r.push([t,i.length].concat(s))}),r},e.oddOneOut=function(t){t=t.slice(),t.unshift(t.splice(1,1)[0]);var e=p(t,u);return 0==e?t[1]:~e?t[e]:void 0},e.insertMergeOverDelete=function(t){t=t.slice(),t.splice(1,1);for(var e,n=0;n<t.length;n++)if(t[n].length){if(e)return;e=t[n]}return e};var d=t&&t.rules||[e.oddOneOut,e.insertMergeOverDelete];return e};n(null,n)}),t.define("/node_modules/dt-list/package.json",function(t,e){e.exports={name:"dt-list",description:"Δt list controller - async & dynamic templating engine",version:"0.1.4",homepage:"https://github.com/dodo/node-dt-list",author:"dodo (https://github.com/dodo)",repository:{type:"git",url:"git://github.com/dodo/node-dt-list.git"},main:"dt-list.js",engines:{node:">= 0.4.x"},keywords:["dt","async","dynamic","event","template","stream","browser","list","order"],scripts:{prepublish:"cake build"},dependencies:{order:">= 0.1.0"},peerDependencies:{dynamictemplate:">= 0.7.1"},devDependencies:{browserify:"1.6.1",scopify:">= 0.2.1",muffin:">= 0.2.6","coffee-script":">= 1.1.3"},licenses:[{type:"MIT",url:"http://github.com/dodo/node-dynamictemplate/raw/master/LICENSE"}]}}),t.define("/node_modules/dt-list/dt-list.js",function(t,e){e.exports=t("./lib/list")}),t.define("/node_modules/dt-list/lib/list.js",function(t,e){!function(){var n,r,i,s={}.hasOwnProperty,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l=[].slice;r=t("order").Order,i=function(t){var e;return t=null!=(e=t.xml)?e:t,n.warn&&t.once("added",function(){var e,r,i,s;return e=t.root(),n.warn&&null!=e.builder?(null==(null!=(r=e.builder.adapters)?null!=(i=r.browser)?null!=(s=i.plugins)?s.list:void 0:void 0:void 0)&&console.warn("dt-list adapter plugin is missing!"),n.warn=!1):void 0}),function(e){return t._list_ready=e,t}},n=function(t){function e(){e.__super__.constructor.call(this,function(t){var e,n,r;return r=t.idx,n=t.before,e=t.after,this[r]._list={idx:r,before:n,after:e,list:this}})}return o(e,t),e.prototype.push=function(t){return e.__super__.push.call(this,i(t))},e.prototype.unshift=function(t){return e.__super__.unshift.call(this,i(t))},e.prototype.insert=function(t,n){return e.__super__.insert.call(this,t,i(n))},e.prototype.splice=function(){var t,n,r,s;return s=arguments[0],t=arguments[1],r=3<=arguments.length?l.call(arguments,2):[],e.__super__.splice.apply(this,[s,t].concat(l.call(function(){var t,e,s;for(s=[],t=0,e=r.length;e>t;t++)n=r[t],s.push(i(n));return s}())))},e}(r),n.List=n,e.exports=n,n.warn=!0,"browser"===process.title&&function(){return null!=this.dynamictemplate?this.dynamictemplate.List=n:this.dynamictemplate={List:n}}.call(window)}.call(this)}),t.define("/node_modules/dt-list/node_modules/order/package.json",function(t,e){e.exports={name:"order",description:"handle ordered async lists",version:"0.1.0",homepage:"https://github.com/dodo/node-order",author:"dodo (https://github.com/dodo)",repository:{type:"git",url:"git://github.com/dodo/node-order.git"},main:"order.js",engines:{node:">= 0.4.x"},keywords:["order","list","array","collection","sequence","async","control","flow"],scripts:{test:"cake build && nodeunit test",prepublish:"cake build"},devDependencies:{nodeunit:">= 0.5.4",muffin:">= 0.2.6","coffee-script":">= 1.1.3"}}}),t.define("/node_modules/dt-list/node_modules/order/order.js",function(t,e){e.exports=t("./lib/order")}),t.define("/node_modules/dt-list/node_modules/order/lib/order.js",function(t,e){!function(){var t,n,r,i,s,o,l=[].slice,a={}.hasOwnProperty,u=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};o=Array.prototype.splice,r=function(t){return t._sync=!0,t},s=function(t,e){return"function"==typeof t._sync&&t._sync(),delete t._sync,e},n=function(t,e){return t._sync?t._sync=e:e()},i=function(){var t,e,r,i,s,o=this;if(s=arguments[0],e=2<=arguments.length?l.call(arguments,1):[],i=s.i,!isNaN(i)&&!this.done[i]){for(this.done[i]=!0,t=i+1;this.done[t]===!1;)t++;for(void 0===this.done[t]&&(t=-1),r=i-1;this.done[r]===!1;)r--;return void 0===this.done[r]&&(r=-1),n(this,function(){var n;return null!=(n=o.callback)?n.call.apply(n,[o,{idx:i,before:r,after:t}].concat(l.call(e))):void 0})}},t=function(t){function e(t){this.callback=t,this.keys=[],this.done=[],e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.push=function(t){var n;if(null!=t)return n={i:this.length},this.done.push(!1),this.keys.push(n),s(this,e.__super__.push.call(this,t(i.bind(r(this),n))))},e.prototype.unshift=function(t){var n,o,l,a,u;if(null!=t){for(o={i:0},u=this.keys,l=0,a=u.length;a>l;l++)n=u[l],n.i++;return this.done.unshift(!1),this.keys.unshift(o),s(this,e.__super__.unshift.call(this,t(i.bind(r(this),o))))}},e.prototype.pop=function(){var t;return null!=(t=this.keys[this.keys.length-1])&&(t.i=0/0),this.done.pop(),this.keys.pop(),e.__super__.pop.apply(this,arguments)},e.prototype.shift=function(){var t,n,r,i,s;for(null!=(i=this.keys[0])&&(i.i=0/0),this.done.shift(),this.keys.shift(),s=this.keys,n=0,r=s.length;r>n;n++)t=s[n],t.i--;return e.__super__.shift.apply(this,arguments)},e.prototype.insert=function(t,e){var n,l,a,u,c;if(null!=e){for(l={i:t},c=this.keys.slice(t),a=0,u=c.length;u>a;a++)n=c[a],n.i++;return this.keys.splice(t,0,l),this.done.splice(t,0,!1),s(this,o.call(this,t,0,e(i.bind(r(this),l))))}},e.prototype.remove=function(t){var e,n,r,i,s,l;for(null!=(i=this.keys[t])&&(i.i=0/0),this.done.splice(t,1),this.keys.splice(t,1),s=this.keys.slice(t),n=0,r=s.length;r>n;n++)e=s[n],e.i--;return null!=(l=o.call(this,t,1))?l[0]:void 0},e.prototype.splice=function(){var t,n,o,a,u,c,h,f,p,d,g,m,v,y,_,b,w,x,k,j,A,O,D,E;if(f=arguments[0],t=arguments[1],a=3<=arguments.length?l.call(arguments,2):[],null==f)return e.__super__.splice.apply(this,arguments);for(p=a.length,A=this.keys.slice(f,f+t),v=0,w=A.length;w>v;v++)o=A[v],o.i=0/0;for(h=function(){var t,e;for(e=[],c=t=0;p>=0?p>t:t>p;c=p>=0?++t:--t)e.push({i:c+f});return e}(),n=function(){var t,e;for(e=[],c=t=0;p>=0?p>t:t>p;c=p>=0?++t:--t)e.push(!1);return e}(),(O=this.done).splice.apply(O,[f,t].concat(l.call(n))),(D=this.keys).splice.apply(D,[f,t].concat(l.call(h))),E=this.keys.slice(f+p),y=0,x=E.length;x>y;y++)o=E[y],o.i=o.i-t+p;for(m=[],c=_=0,k=a.length;k>_;c=++_)u=a[c],r(this),a[c]=u(i.bind(this,h[c])),m.push(this._sync);for(r(this),d=e.__super__.splice.apply(this,[f,t].concat(l.call(a))),b=0,j=m.length;j>b;b++)g=m[b],"function"==typeof g&&g();return s(this),d},e}(Array),t.Order=t,e.exports=t}.call(this)}),t.define("/binding.js",function(t,e){!function(){var n,r,i,s,o,l=[].slice;o=t("./util"),r=o.deep_get,i=o.deep_set,s=o.multiplex,n=function(){function t(t){this.data=null!=t?t:{},this._binds={}}return t.prototype.bind=function(){var t,e,n,r;return n=arguments[0],e=arguments[1],t=3<=arguments.length?l.call(arguments,2):[],null==e&&(e="text"),r=this,s(n,e,t,function(t,e){var n;return(null!=(n=r._binds)[t]?(n=r._binds)[t]:n[t]=[]).push(e.bind(this)),e.call(this,r.get(t))})},t.prototype.unbind=function(t,e){var n,r,i,s,o,l;if(null!=e)for(n=null!=(l=this._binds[t])?l:[],i=s=0,o=n.length;o>s;i=++s)r=n[i],(e===r||r.method===e)&&n.splice(i,1);else delete this._binds[t];return this},t.prototype.trigger=function(t,e){var n,r,i,s,o,l,a;for(a=null!=(l=this._binds[t])?l:[],s=0,o=a.length;o>s;s++)n=a[s],n(e);if(e&&"object"==typeof e)for(r in e)i=e[r],this.trigger(""+t+"."+r,i);return this},t.prototype.set=function(t,e){var n;return n=i(this.data,t,e),null!=n&&this.trigger(t,e),e},t.prototype.get=function(t){return r(this.data,t)},t.prototype.change=function(t){var e,n;null==t&&(t={});for(e in t)n=t[e],this.set(e,n);return this},t}(),n.Binding=n,e.exports=n}.call(this)}),t.define("/util.js",function(t,e){!function(){var t,n,r,i,s,o=[].slice;i=Array.isArray,t=function(t,e){var n,r,i,s,o;if(null!=t){if(!e.length)return t;for(o=e.split("."),i=0,s=o.length;s>i&&(n=o[i],r=t[n],"function"==typeof r&&(r=r.call(t)),t=r,null!=t);i++);return t}},n=function(e,n,r){var i;if(null!=e)return n=n.split("."),i=n.pop(),e=t(e,n.join(".")),null!=e?e[i]=r:void 0},r=function(t,e){var n,r;return"function"==typeof t?function(){var n;return n=1<=arguments.length?o.call(arguments,0):[],t.apply(this,e.concat(n))}:(i(t)?(r=t,t=function(){var t,n,s,l,a,u;for(n=1<=arguments.length?o.call(arguments,0):[],s=0,l=r.length;l>s;s++)t=r[s],a=i(t)?t:[t],t=a[0],e=2<=a.length?o.call(a,1):[],null!=(u=this[t])&&u.apply(this,e.concat(n))},t.method=r):(n=t,t=function(){var t,r;return t=1<=arguments.length?o.call(arguments,0):[],null!=(r=this[n])?r.apply(this,e.concat(t)):void 0},t.method=n),t)},s=function(t,e,n,i){var s;return"object"==typeof t?(s=t,function(){var o;o=[];for(t in s)e=s[t],e=r(e,n),o.push(i.call(this,t,e.bind(this)));return o}):(e=r(e,n),function(){return i.call(this,t,e.bind(this))})},e.exports={deep_get:t,deep_set:n,functionify:r,multiplex:s}}.call(this)}),t("./list")}.call(this);
(function() {
var Binding, deep_get, deep_set, functionify, isArray, multiplex, slice,
var Binding, deep_get, deep_set, multiplex, _ref,
__slice = [].slice;
slice = Array.prototype.slice;
_ref = require('./util'), deep_get = _ref.deep_get, deep_set = _ref.deep_set, multiplex = _ref.multiplex;
isArray = Array.isArray;
deep_get = function(data, keys) {
var key, next, _i, _len, _ref;
if (data == null) {
return;
}
if (!keys.length) {
return data;
}
_ref = keys.split('.');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
next = data[key];
if (typeof next === 'function') {
next = next.call(data);
}
data = next;
if (data == null) {
break;
}
}
return data;
};
deep_set = function(data, keys, value) {
var key;
if (data == null) {
return;
}
keys = keys.split('.');
key = keys.pop();
data = deep_get(data, keys.join('.'));
return data != null ? data[key] = value : void 0;
};
functionify = function(callback, args) {
var method, methods;
if (typeof callback !== 'function') {
if (isArray(callback)) {
methods = callback;
callback = function() {
var method, moargs, _i, _len, _ref, _ref1;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = methods.length; _i < _len; _i++) {
method = methods[_i];
_ref = isArray(method) ? method : [method], method = _ref[0], args = 2 <= _ref.length ? __slice.call(_ref, 1) : [];
if ((_ref1 = this[method]) != null) {
_ref1.apply(this, args.concat(moargs));
}
}
};
callback.method = methods;
} else {
method = callback;
callback = function() {
var moargs, _ref;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return (_ref = this[method]) != null ? _ref.apply(this, args.concat(moargs)) : void 0;
};
callback.method = method;
}
} else {
return function() {
var moargs;
moargs = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return callback.apply(this, args.concat(moargs));
};
}
return callback;
};
multiplex = function(key, callback, args, action) {
var callbacks;
if (typeof key === 'object') {
callbacks = key;
return function() {
var _results;
_results = [];
for (key in callbacks) {
callback = callbacks[key];
callback = functionify(callback, args);
_results.push(action.call(this, key, callback.bind(this)));
}
return _results;
};
} else {
callback = functionify(callback, args);
return function() {
return action.call(this, key, callback.bind(this));
};
}
};
Binding = (function() {

@@ -122,5 +28,5 @@ function Binding(data) {

Binding.prototype.unbind = function(key, callback) {
var callbacks, fun, i, _i, _len, _ref;
var callbacks, fun, i, _i, _len, _ref1;
if (callback != null) {
callbacks = (_ref = this._binds[key]) != null ? _ref : [];
callbacks = (_ref1 = this._binds[key]) != null ? _ref1 : [];
for (i = _i = 0, _len = callbacks.length; _i < _len; i = ++_i) {

@@ -139,6 +45,6 @@ fun = callbacks[i];

Binding.prototype.trigger = function(key, value) {
var callback, subkey, subval, _i, _len, _ref, _ref1;
_ref1 = (_ref = this._binds[key]) != null ? _ref : [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
callback = _ref1[_i];
var callback, subkey, subval, _i, _len, _ref1, _ref2;
_ref2 = (_ref1 = this._binds[key]) != null ? _ref1 : [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
callback = _ref2[_i];
callback(value);

@@ -184,4 +90,2 @@ }

Binding.multiplex = multiplex;
Binding.Binding = Binding;

@@ -188,0 +92,0 @@

(function() {
var Binding, List, ListBinding, adiff, boundpartial, createBinding, deep_set, isArray, listadd, listpartial, listpartialize, listrm, listswitch, listsync, multiplex, slice, _ref,
var Binding, List, ListBinding, adiff, boundpartial, createBinding, deep_get, deep_set, isArray, listadd, listpartial, listpartialize, listrm, listswitch, listsync, multiplex, slice, _ref,
__slice = [].slice,

@@ -15,4 +15,6 @@ __hasProp = {}.hasOwnProperty,

_ref = require('./binding'), Binding = _ref.Binding, multiplex = _ref.multiplex;
Binding = require('./binding').Binding;
_ref = require('./util'), multiplex = _ref.multiplex, deep_get = _ref.deep_get;
adiff = adiff({

@@ -38,3 +40,3 @@ equal: function(a, b) {

boundpartial = function() {
var args, binding, create, partial, value;
var args, binding, create, el, partial, value, _ref1;
create = arguments[0], value = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];

@@ -46,4 +48,5 @@ binding = createBinding(value);

}
if (typeof binding === 'object') {
partial._bind = binding;
el = (_ref1 = partial.xml) != null ? _ref1 : partial;
if (typeof value === 'object') {
el._bind = binding;
}

@@ -164,3 +167,3 @@ return partial;

deep_set = function(items, data, key, value) {
var binding, curdata, curkey, i, k, keys, last_key, next, restkeys, result, _i, _len, _ref1;
var binding, curdata, curkey, i, index, k, keys, last_key, next, restkeys, result, _i, _len, _ref1;
keys = key.split('.');

@@ -179,8 +182,8 @@ last_key = keys.pop();

if (isArray(data)) {
i = keys.pop();
restkeys = keys.slice(i + 1);
restkeys.push(last_key);
binding = (_ref1 = items[curkey][i]) != null ? _ref1._bind : void 0;
index = restkeys.shift();
binding = (_ref1 = items[curkey][index]) != null ? _ref1._bind : void 0;
if (restkeys.length === 0) {
curdata[k][i] = value;
curdata[k][index] = value;
result = binding != null ? binding.change(value) : void 0;

@@ -218,2 +221,15 @@ } else {

ListBinding.prototype.unbind = function(key) {
if (this.items[key] != null) {
delete this.items[key];
}
if (this.values[key] != null) {
delete this.values[key];
}
if (this.partials[key] != null) {
delete this.partials[key];
}
return ListBinding.__super__.unbind.apply(this, arguments);
};
ListBinding.prototype.repeat = function() {

@@ -240,13 +256,17 @@ var args, callback, items, key, old, that;

ListBinding.prototype.unbind = function(key) {
if (this.items[key] != null) {
delete this.items[key];
ListBinding.prototype.each = function() {
var args, callback, key, that;
key = arguments[0], callback = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
if (callback == null) {
callback = 'text';
}
if (this.values[key] != null) {
delete this.values[key];
}
if (this.partials[key] != null) {
delete this.partials[key];
}
return ListBinding.__super__.unbind.apply(this, arguments);
that = this;
return multiplex(key, callback, args, function(key, callback) {
var _ref1;
return (_ref1 = that.items[key]) != null ? _ref1.forEach(function(item, i) {
if ((item != null ? item._bind : void 0) != null) {
return callback(item._bind, i);
}
}) : void 0;
})();
};

@@ -263,7 +283,26 @@

ListBinding.prototype.indexOf = function(key, subkey, value) {
var data, i, _i, _len, _ref1, _ref2;
_ref2 = (_ref1 = this.get(key)) != null ? _ref1 : [];
for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) {
data = _ref2[i];
if (deep_get(data, subkey) === value) {
return i;
}
}
return -1;
};
ListBinding.prototype.addTo = function(key, value) {
var _base, _ref1;
if ((_ref1 = this.get(key)) != null) {
if (typeof _ref1.push === "function") {
_ref1.push(value);
var binding, i, restkeys, subkey, _base, _ref1, _ref2;
if (/\.\d+\./.test(key)) {
subkey = key.split(/\.\d+\./, 1)[0];
restkeys = key.substr(subkey.length + 1).split('.');
i = restkeys.shift();
binding = (_ref1 = this.items[subkey][i]) != null ? _ref1._bind : void 0;
return binding != null ? binding.addTo(restkeys.join('.'), value) : void 0;
}
if ((_ref2 = this.get(key)) != null) {
if (typeof _ref2.push === "function") {
_ref2.push(value);
}

@@ -270,0 +309,0 @@ }

{ "name": "dt-binding"
, "description": "Δt data bindings - async & dynamic templating engine"
, "version": "0.1.1"
, "version": "0.2.0"
, "homepage": "https://github.com/dodo/node-dt-binding"

@@ -16,4 +16,4 @@ , "author": "dodo (https://github.com/dodo)"

, "peerDependencies": {
"dt-list": ">= 0.1.3",
"dynamictemplate": ">= 0.7.0"}
"dt-list": ">= 0.1.4",
"dynamictemplate": ">= 0.7.1"}
, "devDependencies": {

@@ -20,0 +20,0 @@ "jquery": "1.8.3",

@@ -136,2 +136,76 @@ (function() {

},
addTo: function(æ) {
var $, api, data, testData, tpl;
this.æ = æ;
$ = this.$, api = this.api;
data = new Binding({
title: "foobar",
css: "fun.css",
content: []
});
testData = [
{
type: 'header',
body: "foobar"
}, {
type: 'main',
body: "hello world"
}, {
type: 'footer',
body: "big foot"
}
];
setTimeout(function() {
return testData.forEach(data.addTo.bind(data, 'content'));
}, 16);
tpl = this.tpl = jqueryify({
$: $
}, new Template({
schema: 5
}, function() {
return this.$html(function() {
this.$head(function() {
this.$title(data.bind('title'));
return this.$link({
type: 'text/css'
}, data.bind('css', 'attr', 'href'));
});
return this.$body(data.repeat('content', function(content) {
return this['$' + content.get('type')](content.bind('body'));
}));
});
}));
return this.results = ['<html>', "<head>", "<title>foobar</title>", '<link type="text/css" href="fun.css">', "</head>", "<body>", "<header>foobar</header>", "<main>hello world</main>", "<footer>big foot</footer>", "</body>", "</html>"];
},
'deep addTo': function(æ) {
var $, api, data, testData, tpl;
this.æ = æ;
$ = this.$, api = this.api;
data = new Binding({
title: "foobar",
css: "fun.css",
content: [
{
type: 'head'
}, {
type: 'body',
text: []
}
]
});
testData = ["foobar", "hello world", "big foot"];
setTimeout(function() {
return testData.forEach(data.addTo.bind(data, 'content.1.text'));
}, 16);
tpl = this.tpl = jqueryify({
$: $
}, new Template({
schema: 5
}, function() {
return this.$html(data.repeat('content', function(content) {
return this['$' + content.get('type')](content.repeat('text', '$span'));
}));
}));
return this.results = ['<html>', "<head>", "</head>", "<body>", "<span>foobar</span>", "<span>hello world</span>", "<span>big foot</span>", "</body>", "</html>"];
},
sync: function(æ) {

@@ -181,3 +255,3 @@ var $, api, data, tpl;

type: 'header',
body: "trololo"
body: "PANIC"
});

@@ -188,3 +262,3 @@ }, 16);

content = data.get('content');
content[0].body = "trololo";
content[0].body = "fun";
return data.set('content', [content[2], content[3], content[1], content[0]]);

@@ -198,3 +272,3 @@ }, 23);

}, 64);
return this.results = ['<html>', "<head>", "<title>foobar</title>", '<link type="text/css" href="pink.css">', "</head>", "<body>", "<header>foobar</header>", "<header>trololo</header>", "<main>hello world</main>", "<footer>tada</footer>", "</body>", "</html>"];
return this.results = ['<html>', "<head>", "<title>foobar</title>", '<link type="text/css" href="pink.css">', "</head>", "<body>", "<header>foobar</header>", "<header>fun</header>", "<main>hello world</main>", "<footer>tada</footer>", "</body>", "</html>"];
}

@@ -201,0 +275,0 @@ }

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