},{}],11:[function(require,module,exports){ "use strict"; var method = require("method") var send = method("send") module.exports = send },{"method":4}],12:[function(require,module,exports){
function variator(hint) { var dispatcher = method(hint) var prefixes = [] var implementations = [] dispatcher[labels] = prefixes dispatcher[cases] = implementations dispatcher.define(function dispatch(label) { var index = prefixes.indexOf(label) var implementation = implementations[index] if (!implementation) throw TypeError("Method " + dispatcher + " not implemented for: " + label) return implementation.apply(dispatcher, arguments) }) define.implement(dispatcher, extendVariator) implement.implement(dispatcher, extendVariator) return dispatcher }
"use strict"; var method = require("method") var send = method("send") module.exports = send
"use strict"; var method = require("method") var when = method("when") when.define(function(value, onRealize) { return typeof(onRealize) === "function" ? onRealize(value) : value }) when.define(Error, function(error, onRealize, onError) { return typeof(onError) === "function" ? onError(error) : error }) module.exports = when
"use strict"; var method = require("method") var watchers = require("./watchers") var watch = method("watch") watch.define(function(value, watcher) { // Registers a `value` `watcher`, unless it"s already registered. var registered = watchers(value) if (registered && registered.indexOf(watcher) < 0) registered.push(watcher) return value }) module.exports = watch
"use strict"; var method = require("method") // Method delivers pending value. var deliver = method("deliver") module.exports = deliver
"use strict"; var method = require("method") var rebase = require("./rebase") // Method is designed to work with data structures representing application // state. Calling it with a state and delta should return object representing // new state, with changes in `delta` being applied to previous. // // ## Example // // patch(state, { // "item-id-1": { completed: false }, // update // "item-id-2": null // delete // }) var patch = method("patch@diffpatcher") patch.define(Object, function patch(hash, delta) { return rebase({}, hash, delta) }) module.exports = patch
/* vim:set ts=2 sw=2 sts=2 expandtab */ /*jshint asi: true undef: true es5: true node: true devel: true globalstrict: true forin: true latedef: false supernew: true */ /*global define: true */ "use strict"; var Method = require('method') // Module defines protocol of `values` that can be watched. In order to support // this protocol one just needs to implement `watchers` method. var watchers = Method() exports.watchers = watchers // Registers a `value` `watcher` function unless it already watches it. var watch = Method(function(value, watcher) { var listeners = watchers(value) if (listeners && listeners.indexOf(watcher) < 0) listeners.push(watcher) return value }) exports.watch = watch // Unregisters a `value` `watcher` function if it's being watched. var unwatch = Method(function(value, watcher) { var listeners = watchers(value) var index = listeners && listeners.indexOf(watcher) if (listeners && listeners.indexOf(watcher) >= 0) listeners.splice(index, 1) return value })
var method = require('method') var set = method(function set(key, obj, val){ obj[key] = val return obj }, 1) module.exports = set
"use strict"; var method = require("method") var isReduced = require("./is-reduced") var isError = require("./is-error") var end = require("./end") var reduce = method("reduce@reducible") // Implementation of `reduce` for the empty collections, that immediately // signals reducer that it's ended. reduce.empty = function reduceEmpty(empty, next, initial) { next(end, initial) } // Implementation of `reduce` for the singular values which are treated // as collections with a single element. Yields a value and signals the end. reduce.singular = function reduceSingular(value, next, initial) { next(end, next(value, initial)) } // Implementation of `reduce` for the array (and alike) values, such that it // will call accumulator function `next` each time with next item and // accumulated state until it's exhausted or `next` returns marked value // indicating that it's reduced. Either way signals `end` to an accumulator. reduce.indexed = function reduceIndexed(indexed, next, initial) { var state = initial var index = 0 var count = indexed.length while (index < count) {
var method = require('method') var conj = method(null, 1) conj.def(Array.prototype, function(a, b){ return b.concat(a) }) conj.def(Object.prototype, function(a, b){ var c = Object.create(b) for (var k in a) c[k] = a[k] return c }) module.exports = conj
var method = require('method') var Map = require('./Map') var call = Function.call var invoke = method() function get(object, key){ return object[key] } invoke.def(Map.prototype, get) invoke.def(Array.prototype, get) invoke.def(Function.prototype, function(){ var fn = arguments[0] arguments[0] = this return call.apply(fn, arguments) }) module.exports = invoke
},{}],9:[function(require,module,exports){ "use strict"; var method = require("method") var isReduced = require("./is-reduced") var isError = require("./is-error") var end = require("./end") var reduce = method("reduce@reducible") // Implementation of `reduce` for the empty collections, that immediately // signals reducer that it's ended. reduce.empty = function reduceEmpty(empty, next, initial) { next(end, initial) } // Implementation of `reduce` for the singular values which are treated // as collections with a single element. Yields a value and signals the end. reduce.singular = function reduceSingular(value, next, initial) { next(end, next(value, initial)) } // Implementation of `reduce` for the array (and alike) values, such that it // will call accumulator function `next` each time with next item and // accumulated state until it's exhausted or `next` returns marked value // indicating that it's reduced. Either way signals `end` to an accumulator. reduce.indexed = function reduceIndexed(indexed, next, initial) { var state = initial var index = 0 var count = indexed.length while (index < count) { var value = indexed[index] state = next(value, state) index = index + 1 if (value === end) return end if (isError(value)) return state if (isReduced(state)) return state.value } next(end, state) } // Both `undefined` and `null` implement accumulate for empty sequences. reduce.define(void(0), reduce.empty) reduce.define(null, reduce.empty) // Array and arguments implement accumulate for indexed sequences. reduce.define(Array, reduce.indexed) function Arguments() { return arguments } Arguments.prototype = Arguments() reduce.define(Arguments, reduce.indexed) // All other built-in data types are treated as single value collections // by default. Of course individual types may choose to override that. reduce.define(reduce.singular) // Errors just yield that error. reduce.define(Error, function(error, next) { next(error) }) module.exports = reduce },{"./end":5,"./is-error":6,"./is-reduced":7,"method":8}],10:[function(require,module,exports){
"use strict"; var method = require("method") var isReduced = require("./is-reduced") var isError = require("./is-error") var end = require("./end") var reduce = method("reduce") // Implementation of `reduce` for the empty collections, that immediately // signals reducer that it's ended. reduce.empty = function reduceEmpty(empty, next, initial) { next(end, initial) } // Implementation of `reduce` for the singular values which are treated // as collections with a single element. Yields a value and signals the end. reduce.singular = function reduceSingular(value, next, initial) { next(end, next(value, initial)) } // Implementation of `reduce` for the array (and alike) values, such that it // will call accumulator function `next` each time with next item and // accumulated state until it's exhausted or `next` returns marked value // indicating that it's reduced. Either way signals `end` to an accumulator. reduce.indexed = function reduceIndexed(indexed, next, initial) { var state = initial var index = 0 var count = indexed.length while (index < count) {