Comparing version 1.0.0-alpha-04 to 1.0.0-alpha-05
167
lib/array.js
@@ -1,8 +0,8 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, binary, compose, curry, deep_equal, describe, detach, flip, identity, lt, odd, partial, ternary, unary, _, _ref, _ref1, _ref2, | ||
__slice = [].slice, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
var _, assert, binary, compose, curry, deep_equal, describe, detach, flip, identity, lt, odd, partial, ref, ref1, ref2, ternary, unary, | ||
slice1 = [].slice, | ||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
_ref = require("./core"), curry = _ref.curry, flip = _ref.flip, compose = _ref.compose, partial = _ref.partial, _ = _ref._, identity = _ref.identity, unary = _ref.unary, binary = _ref.binary, ternary = _ref.ternary; | ||
ref = require("./core"), curry = ref.curry, flip = ref.flip, compose = ref.compose, partial = ref.partial, _ = ref._, identity = ref.identity, unary = ref.unary, binary = ref.binary, ternary = ref.ternary; | ||
@@ -13,61 +13,8 @@ detach = require("./object").detach; | ||
_ref1 = require("./numeric"), odd = _ref1.odd, lt = _ref1.lt; | ||
ref1 = require("./numeric"), odd = ref1.odd, lt = ref1.lt; | ||
_ref2 = require("./helpers"), assert = _ref2.assert, describe = _ref2.describe; | ||
ref2 = require("./helpers"), assert = ref2.assert, describe = ref2.describe; | ||
describe("Array functions", function(context) { | ||
var all, any, cat, difference, drop, dupes, each, filter, first, flatten, fold, foldr, includes, intersection, last, leave, map, range, remove, rest, shuffle, slice, take, union, uniq, unique, unique_by; | ||
fold = curry(flip(ternary(detach(Array.prototype.reduce)))); | ||
context.test("fold", function() { | ||
var data, fn; | ||
data = [1, 2, 3, 4, 5]; | ||
fn = fold(1, function(acc, x) { | ||
return acc += x; | ||
}); | ||
return assert(deep_equal(fn(data), 16)); | ||
}); | ||
foldr = curry(flip(ternary(detach(Array.prototype.reduce)))); | ||
context.test("foldr", function() { | ||
var data, fn; | ||
data = [1, 2, 3, 4, 5]; | ||
fn = foldr(1, function(acc, x) { | ||
return acc += x; | ||
}); | ||
return assert(deep_equal(fn(data), 16)); | ||
}); | ||
map = curry(flip(binary(detach(Array.prototype.map)))); | ||
context.test("map", function() { | ||
var data; | ||
data = [1, 2, 3, 4, 5]; | ||
return assert(deep_equal(map((function(x) { | ||
return x * 2; | ||
}), data), [2, 4, 6, 8, 10])); | ||
}); | ||
filter = curry(flip(binary(detach(Array.prototype.filter)))); | ||
context.test("filter", function() { | ||
var data; | ||
data = [1, 2, 3, 4, 5]; | ||
return assert(deep_equal(filter(odd, data), [1, 3, 5])); | ||
}); | ||
any = curry(flip(binary(detach(Array.prototype.some)))); | ||
context.test("any", function() { | ||
var data; | ||
data = [1, 2, 3, 4, 5]; | ||
return assert(any(odd, data)); | ||
}); | ||
all = curry(flip(binary(detach(Array.prototype.every)))); | ||
context.test("all", function() { | ||
var data; | ||
data = [1, 2, 3, 4, 5]; | ||
return assert(all(lt(6), data)); | ||
}); | ||
each = curry(flip(binary(detach(Array.prototype.forEach)))); | ||
context.test("each", function() { | ||
return (function(ax, data) { | ||
each((function(x) { | ||
return ax.push(x); | ||
}), data); | ||
return assert(deep_equal(ax, data)); | ||
})([], [1, 2, 3, 4, 5]); | ||
}); | ||
var cat, difference, dupes, first, includes, intersection, last, range, remove, rest, second, shuffle, slice, third, union, uniq, unique, unique_by; | ||
cat = detach(Array.prototype.concat); | ||
@@ -90,5 +37,11 @@ context.test("cat", function() { | ||
}); | ||
last = function(_arg) { | ||
var rest, x, _i; | ||
rest = 2 <= _arg.length ? __slice.call(_arg, 0, _i = _arg.length - 1) : (_i = 0, []), x = _arg[_i++]; | ||
second = function(ax) { | ||
return ax[1]; | ||
}; | ||
third = function(ax) { | ||
return ax[2]; | ||
}; | ||
last = function(arg) { | ||
var k, rest, x; | ||
rest = 2 <= arg.length ? slice1.call(arg, 0, k = arg.length - 1) : (k = 0, []), x = arg[k++]; | ||
return x; | ||
@@ -107,24 +60,4 @@ }; | ||
}); | ||
take = slice(0); | ||
context.test("take", function() { | ||
return (function(data) { | ||
return assert(deep_equal(take(3, data), [1, 2, 3])); | ||
})([1, 2, 3, 4, 5]); | ||
}); | ||
leave = curry(function(n, ax) { | ||
return slice(0, -n, ax); | ||
}); | ||
context.test("leave", function() { | ||
return (function(data) { | ||
return assert(deep_equal(leave(3, data), [1, 2])); | ||
})([1, 2, 3, 4, 5]); | ||
}); | ||
drop = curry(partial(slice, _, void 0, _)); | ||
context.test("drop", function() { | ||
return (function(data) { | ||
return assert(deep_equal(drop(3, data), [4, 5])); | ||
})([1, 2, 3, 4, 5]); | ||
}); | ||
includes = function(x, ax) { | ||
return __indexOf.call(ax, x) >= 0; | ||
return indexOf.call(ax, x) >= 0; | ||
}; | ||
@@ -138,8 +71,8 @@ context.test("includes", function() { | ||
unique_by = curry(function(f, ax) { | ||
var a, bx, y, _i, _len; | ||
var a, bx, k, len, y; | ||
bx = []; | ||
for (_i = 0, _len = ax.length; _i < _len; _i++) { | ||
a = ax[_i]; | ||
for (k = 0, len = ax.length; k < len; k++) { | ||
a = ax[k]; | ||
y = f(a); | ||
if (__indexOf.call(bx, y) < 0) { | ||
if (indexOf.call(bx, y) < 0) { | ||
bx.push(y); | ||
@@ -156,17 +89,2 @@ } | ||
}); | ||
flatten = function(ax) { | ||
return fold([], (function(r, a) { | ||
if (a.forEach != null) { | ||
r.push.apply(r, flatten(a)); | ||
} else { | ||
r.push(a); | ||
} | ||
return r; | ||
}), ax); | ||
}; | ||
context.test("flatten", function() { | ||
return (function(data) { | ||
return assert(deep_equal(flatten(data), [1, 2, 3, 4, 5, 6, 7])); | ||
})([1, [2, 3], 4, [5, [6, 7]]]); | ||
}); | ||
difference = curry(function(ax, bx) { | ||
@@ -176,12 +94,12 @@ var cx; | ||
return cx.filter(function(c) { | ||
return (__indexOf.call(ax, cx) >= 0 && !(__indexOf.call(bx, cx) >= 0)) || (__indexOf.call(bx, cx) >= 0 && !(__indexOf.call(bx, cx) >= 0)); | ||
return (indexOf.call(ax, cx) >= 0 && !(indexOf.call(bx, cx) >= 0)) || (indexOf.call(bx, cx) >= 0 && !(indexOf.call(bx, cx) >= 0)); | ||
}); | ||
}); | ||
dupes = function(_arg) { | ||
dupes = function(arg) { | ||
var first, rest; | ||
first = _arg[0], rest = 2 <= _arg.length ? __slice.call(_arg, 1) : []; | ||
first = arg[0], rest = 2 <= arg.length ? slice1.call(arg, 1) : []; | ||
if (rest.length === 0) { | ||
return []; | ||
} else if (__indexOf.call(rest, first) >= 0) { | ||
return [first].concat(__slice.call(dupes(rest))); | ||
} else if (indexOf.call(rest, first) >= 0) { | ||
return [first].concat(slice1.call(dupes(rest))); | ||
} else { | ||
@@ -199,5 +117,5 @@ return dupes(rest); | ||
remove = function(array, element) { | ||
var index, _ref3; | ||
var index, ref3; | ||
if ((index = array.indexOf(element)) > -1) { | ||
[].splice.apply(array, [index, index - index + 1].concat(_ref3 = [])), _ref3; | ||
[].splice.apply(array, [index, index - index + 1].concat(ref3 = [])), ref3; | ||
return element; | ||
@@ -209,6 +127,6 @@ } else { | ||
shuffle = function(ax) { | ||
var b, bx, i, j, _i, _len, _ref3; | ||
var b, bx, i, j, k, len, ref3; | ||
bx = cat(ax); | ||
if (!(bx.length <= 1)) { | ||
for (i = _i = 0, _len = bx.length; _i < _len; i = ++_i) { | ||
for (i = k = 0, len = bx.length; k < len; i = ++k) { | ||
b = bx[i]; | ||
@@ -219,3 +137,3 @@ j = i; | ||
} | ||
_ref3 = [bx[j], bx[i]], bx[i] = _ref3[0], bx[j] = _ref3[1]; | ||
ref3 = [bx[j], bx[i]], bx[i] = ref3[0], bx[j] = ref3[1]; | ||
} | ||
@@ -237,7 +155,7 @@ if (deep_equal(ax, bx)) { | ||
range = function(start, finish) { | ||
var _i, _results; | ||
var k, results; | ||
return (function() { | ||
_results = []; | ||
for (var _i = start; start <= finish ? _i <= finish : _i >= finish; start <= finish ? _i++ : _i--){ _results.push(_i); } | ||
return _results; | ||
results = []; | ||
for (var k = start; start <= finish ? k <= finish : k >= finish; start <= finish ? k++ : k--){ results.push(k); } | ||
return results; | ||
}).apply(this); | ||
@@ -249,17 +167,9 @@ }; | ||
return module.exports = { | ||
fold: fold, | ||
foldr: foldr, | ||
map: map, | ||
filter: filter, | ||
any: any, | ||
all: all, | ||
each: each, | ||
cat: cat, | ||
slice: slice, | ||
first: first, | ||
second: second, | ||
third: third, | ||
last: last, | ||
rest: rest, | ||
take: take, | ||
leave: leave, | ||
drop: drop, | ||
includes: includes, | ||
@@ -269,3 +179,2 @@ unique_by: unique_by, | ||
uniq: uniq, | ||
flatten: flatten, | ||
dupes: dupes, | ||
@@ -272,0 +181,0 @@ union: union, |
@@ -1,10 +0,10 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, describe, _ref, | ||
__slice = [].slice; | ||
var assert, describe, ref, | ||
slice = [].slice; | ||
_ref = require("./helpers"), assert = _ref.assert, describe = _ref.describe; | ||
ref = require("./helpers"), assert = ref.assert, describe = ref.describe; | ||
describe("Functional programming functions", function(context) { | ||
var binary, compose, curry, deep_equal, flip, identity, no_op, partial, pipe, ternary, unary, variadic, wrap, _; | ||
var _, binary, compose, curry, deep_equal, flip, identity, no_op, partial, pipe, ternary, unary, variadic, wrap; | ||
deep_equal = function(a, b) { | ||
@@ -49,3 +49,3 @@ assert = require("assert"); | ||
var bx, cx; | ||
bx = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
bx = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
cx = ax.concat(bx); | ||
@@ -84,15 +84,15 @@ if (cx.length < f.length) { | ||
var ax, f; | ||
f = arguments[0], ax = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
f = arguments[0], ax = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
return function() { | ||
var a, bx; | ||
bx = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
bx = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
bx = [].concat(bx); | ||
return f.apply(null, ((function() { | ||
var _i, _len, _results; | ||
_results = []; | ||
for (_i = 0, _len = ax.length; _i < _len; _i++) { | ||
a = ax[_i]; | ||
_results.push(a === _ ? bx.shift() : a); | ||
var i, len, results; | ||
results = []; | ||
for (i = 0, len = ax.length; i < len; i++) { | ||
a = ax[i]; | ||
results.push(a === _ ? bx.shift() : a); | ||
} | ||
return _results; | ||
return results; | ||
})()).concat(bx)); | ||
@@ -122,3 +122,3 @@ }; | ||
var ax; | ||
ax = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
ax = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
return f.apply(null, ax.reverse()); | ||
@@ -135,4 +135,4 @@ }; | ||
compose = function() { | ||
var f, fx, g, _i; | ||
fx = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), f = arguments[_i++]; | ||
var f, fx, g, i; | ||
fx = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), f = arguments[i++]; | ||
if (fx.length !== 0) { | ||
@@ -142,3 +142,3 @@ g = compose.apply(null, fx); | ||
var ax; | ||
ax = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
ax = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
return g(f.apply(null, ax)); | ||
@@ -175,3 +175,3 @@ }; | ||
var ax; | ||
ax = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
ax = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
return ax; | ||
@@ -178,0 +178,0 @@ }; |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, describe, _ref; | ||
var assert, describe, ref; | ||
_ref = require("./helpers"), describe = _ref.describe, assert = _ref.assert; | ||
ref = require("./helpers"), describe = ref.describe, assert = ref.assert; | ||
@@ -7,0 +7,0 @@ describe("Crypto Functions", function(context) { |
@@ -1,5 +0,5 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, describe, fs, _ref, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
var assert, describe, fs, ref, | ||
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
@@ -17,3 +17,3 @@ fs = function(f) { | ||
_ref = require("./helpers"), describe = _ref.describe, assert = _ref.assert; | ||
ref = require("./helpers"), describe = ref.describe, assert = ref.assert; | ||
@@ -23,5 +23,5 @@ describe("File system functions", function(context) { | ||
stat = function(path) { | ||
return fs(function(_arg) { | ||
return fs(function(arg) { | ||
var stat; | ||
stat = _arg.stat; | ||
stat = arg.stat; | ||
return stat(path); | ||
@@ -39,6 +39,6 @@ }); | ||
read = function(path) { | ||
return fs(function(_arg, _arg1) { | ||
return fs(function(arg, arg1) { | ||
var call, readFile; | ||
readFile = _arg.readFile; | ||
call = _arg1.call; | ||
readFile = arg.readFile; | ||
call = arg1.call; | ||
return call(function*() { | ||
@@ -53,5 +53,5 @@ return ((yield readFile(path))).toString(); | ||
readdir = function(path) { | ||
return fs(function(_arg) { | ||
return fs(function(arg) { | ||
var readdir; | ||
readdir = _arg.readdir; | ||
readdir = arg.readdir; | ||
return readdir(path); | ||
@@ -61,3 +61,3 @@ }); | ||
context.test("readdir", function*() { | ||
return assert(__indexOf.call((yield readdir("test")), "test.json") >= 0); | ||
return assert(indexOf.call((yield readdir("test")), "test.json") >= 0); | ||
}); | ||
@@ -98,5 +98,5 @@ read_stream = function(stream) { | ||
}; | ||
read_block = (function(_arg) { | ||
read_block = (function(arg) { | ||
var promise, reject, resolve; | ||
promise = _arg.promise, reject = _arg.reject, resolve = _arg.resolve; | ||
promise = arg.promise, reject = arg.reject, resolve = arg.resolve; | ||
return function(stream) { | ||
@@ -157,5 +157,5 @@ return (function(pending, resolved, _resolve, _reject) { | ||
write = function(path, content) { | ||
return fs(function(_arg) { | ||
return fs(function(arg) { | ||
var writeFile; | ||
writeFile = _arg.writeFile; | ||
writeFile = arg.writeFile; | ||
return writeFile(path, content); | ||
@@ -168,6 +168,6 @@ }); | ||
chdir = function(dir, fn) { | ||
return fs(function*(_arg, _arg1) { | ||
return fs(function*(arg, arg1) { | ||
var async, cwd, rval; | ||
_arg; | ||
async = _arg1.async; | ||
arg; | ||
async = arg1.async; | ||
cwd = process.cwd(); | ||
@@ -180,6 +180,6 @@ process.chdir(dir); | ||
}; | ||
fs(function(_arg, _arg1) { | ||
fs(function(arg, arg1) { | ||
var async; | ||
_arg; | ||
async = _arg1.async; | ||
arg; | ||
async = arg1.async; | ||
return context.test("chdir", function*() { | ||
@@ -186,0 +186,0 @@ (yield chdir("test", async(function*() { |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -7,3 +7,3 @@ var Amen, assert, script; | ||
if (script.match(/test.litcoffee$/)) { | ||
if (script != null ? script.match(/test.litcoffee$/) : void 0) { | ||
assert = require("assert"); | ||
@@ -10,0 +10,0 @@ Amen = require("amen"); |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, describe, _ref; | ||
var assert, describe, ref; | ||
_ref = require("./helpers"), describe = _ref.describe, assert = _ref.assert; | ||
ref = require("./helpers"), describe = ref.describe, assert = ref.assert; | ||
@@ -25,4 +25,4 @@ describe("General functions", function(context) { | ||
return function(x) { | ||
var _name; | ||
return memo[_name = hash(x)] != null ? memo[_name] : memo[_name] = fn(x); | ||
var name; | ||
return memo[name = hash(x)] != null ? memo[name] : memo[name] = fn(x); | ||
}; | ||
@@ -68,12 +68,12 @@ }; | ||
context.test("shell", function*() { | ||
return assert(((yield shell("ls ./test"))).stdout.trim().split("\n").length === 5); | ||
return assert(((yield shell("ls ./test"))).stdout.trim != null); | ||
}); | ||
curry = require("./core").curry; | ||
times = curry(function(fn, n) { | ||
var _results; | ||
_results = []; | ||
var results; | ||
results = []; | ||
while (n-- !== 0) { | ||
_results.push(fn()); | ||
results.push(fn()); | ||
} | ||
return _results; | ||
return results; | ||
}); | ||
@@ -101,2 +101,3 @@ context.test("times", function() { | ||
include(module.exports, require("./array")); | ||
include(module.exports, require("./iterator")); | ||
include(module.exports, require("./crypto")); | ||
@@ -103,0 +104,0 @@ include(module.exports, require("./fs")); |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, curry, describe, _ref; | ||
var assert, curry, describe, ref; | ||
_ref = require("./helpers"), describe = _ref.describe, assert = _ref.assert; | ||
ref = require("./helpers"), describe = ref.describe, assert = ref.assert; | ||
@@ -10,3 +10,3 @@ curry = require("./core").curry; | ||
describe("Logical functions", function(context) { | ||
var f_and, f_eq, f_neq, f_not, f_or; | ||
var f_and, f_eq, f_neq, f_or, negate; | ||
f_and = curry(function(f, g) { | ||
@@ -22,3 +22,3 @@ return function() { | ||
}); | ||
f_not = function(f) { | ||
negate = function(f) { | ||
return function() { | ||
@@ -28,4 +28,4 @@ return !(f.apply(null, arguments)); | ||
}; | ||
context.test("f_not", function() { | ||
return assert(!((f_not(function() { | ||
context.test("negate", function() { | ||
return assert(!((negate(function() { | ||
return true; | ||
@@ -47,3 +47,3 @@ }))())); | ||
f_or: f_or, | ||
f_not: f_not, | ||
negate: negate, | ||
f_eq: f_eq, | ||
@@ -50,0 +50,0 @@ f_neq: f_neq |
@@ -1,10 +0,10 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, curry, describe, f_not, partial, _ref, _ref1; | ||
var assert, curry, describe, negate, partial, ref, ref1; | ||
_ref = require("./core"), curry = _ref.curry, partial = _ref.partial; | ||
ref = require("./core"), curry = ref.curry, partial = ref.partial; | ||
f_not = require("./logical").f_not; | ||
negate = require("./logical").negate; | ||
_ref1 = require("./helpers"), describe = _ref1.describe, assert = _ref1.assert; | ||
ref1 = require("./helpers"), describe = ref1.describe, assert = ref1.assert; | ||
@@ -42,3 +42,3 @@ describe("Numeric functions", function(context) { | ||
even = mod(2); | ||
odd = f_not(even); | ||
odd = negate(even); | ||
context.test("odd", function() { | ||
@@ -45,0 +45,0 @@ return assert(odd(5)); |
@@ -1,9 +0,9 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, compose, curry, deep_equal, describe, _ref, _ref1, | ||
__slice = [].slice; | ||
var assert, compose, curry, deep_equal, describe, ref, ref1, | ||
slice = [].slice; | ||
_ref = require("./helpers"), describe = _ref.describe, assert = _ref.assert; | ||
ref = require("./helpers"), describe = ref.describe, assert = ref.assert; | ||
_ref1 = require("./core"), compose = _ref1.compose, curry = _ref1.curry; | ||
ref1 = require("./core"), compose = ref1.compose, curry = ref1.curry; | ||
@@ -13,8 +13,8 @@ deep_equal = require("./type").deep_equal; | ||
describe("Object functions", function(context) { | ||
var bind, clone, delegate, detach, extend, include, merge, pluck, properties, property; | ||
var bind, clone, delegate, detach, extend, include, merge, properties, property; | ||
include = extend = function() { | ||
var key, mixin, mixins, object, value, _i, _len; | ||
object = arguments[0], mixins = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
for (_i = 0, _len = mixins.length; _i < _len; _i++) { | ||
mixin = mixins[_i]; | ||
var i, key, len, mixin, mixins, object, value; | ||
object = arguments[0], mixins = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
for (i = 0, len = mixins.length; i < len; i++) { | ||
mixin = mixins[i]; | ||
for (key in mixin) { | ||
@@ -29,7 +29,7 @@ value = mixin[key]; | ||
merge = function() { | ||
var destination, k, object, objects, v, _i, _len; | ||
objects = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
var destination, i, k, len, object, objects, v; | ||
objects = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
destination = {}; | ||
for (_i = 0, _len = objects.length; _i < _len; _i++) { | ||
object = objects[_i]; | ||
for (i = 0, len = objects.length; i < len; i++) { | ||
object = objects[i]; | ||
for (k in object) { | ||
@@ -74,6 +74,6 @@ v = object[k]; | ||
context.test("clone"); | ||
pluck = curry(function(key, object) { | ||
property = curry(function(key, object) { | ||
return object[key]; | ||
}); | ||
context.test("pluck", function() { | ||
context.test("property", function() { | ||
var a, baz_foo; | ||
@@ -87,17 +87,17 @@ a = { | ||
}; | ||
assert((pluck("foo", a)) === 1); | ||
baz_foo = compose(pluck("foo"), pluck("baz")); | ||
assert((property("foo", a)) === 1); | ||
baz_foo = compose(property("foo"), property("baz")); | ||
return assert((baz_foo(a)) === 2); | ||
}); | ||
delegate = function(from, to) { | ||
var name, value, _results; | ||
_results = []; | ||
var name, results, value; | ||
results = []; | ||
for (name in to) { | ||
value = to[name]; | ||
if ((type(value)) === "function") { | ||
_results.push((function(value) { | ||
results.push((function(value) { | ||
return from[name] = function() { | ||
var args; | ||
args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; | ||
return value.call.apply(value, [to].concat(__slice.call(args))); | ||
args = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
return value.call.apply(value, [to].concat(slice.call(args))); | ||
}; | ||
@@ -107,3 +107,3 @@ })(value)); | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -122,3 +122,3 @@ context.test("delegate"); | ||
var args, x; | ||
x = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
x = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
return f.apply(x, args); | ||
@@ -132,3 +132,3 @@ }); | ||
}); | ||
properties = property = (function() { | ||
properties = (function() { | ||
var defaults; | ||
@@ -140,10 +140,10 @@ defaults = { | ||
return function(object, properties) { | ||
var key, value, _results; | ||
_results = []; | ||
var key, results, value; | ||
results = []; | ||
for (key in properties) { | ||
value = properties[key]; | ||
include(value, defaults); | ||
_results.push(Object.defineProperty(object, key, value)); | ||
results.push(Object.defineProperty(object, key, value)); | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -180,3 +180,3 @@ })(); | ||
clone: clone, | ||
pluck: pluck, | ||
properties: properties, | ||
property: property, | ||
@@ -183,0 +183,0 @@ delegate: delegate, |
@@ -1,9 +0,12 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, describe, _ref; | ||
var assert, describe, ref; | ||
_ref = require("./helpers"), describe = _ref.describe, assert = _ref.assert; | ||
ref = require("./helpers"), describe = ref.describe, assert = ref.assert; | ||
describe("String functions", function(context) { | ||
var camel_case, capitalize, dashed, html_escape, plain_text, title_case, underscored, w; | ||
var camel_case, capitalize, dashed, html_escape, plain_text, title_case, to_string, underscored, w; | ||
to_string = function(x) { | ||
return x.toString(); | ||
}; | ||
plain_text = function(string) { | ||
@@ -82,2 +85,3 @@ return string.replace(/^[A-Z]/g, function(c) { | ||
return module.exports = { | ||
to_string: to_string, | ||
capitalize: capitalize, | ||
@@ -84,0 +88,0 @@ title_case: title_case, |
@@ -1,11 +0,11 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var assert, curry, deep_equal, describe, _ref, _ref1; | ||
var assert, curry, deep_equal, describe, ref, ref1; | ||
_ref = require("./core"), curry = _ref.curry, deep_equal = _ref.deep_equal; | ||
ref = require("./core"), curry = ref.curry, deep_equal = ref.deep_equal; | ||
_ref1 = require("./helpers"), describe = _ref1.describe, assert = _ref1.assert; | ||
ref1 = require("./helpers"), describe = ref1.describe, assert = ref1.assert; | ||
describe("Type functions", function(context) { | ||
var instance_of, is_type, type; | ||
var instance_of, is_function, is_string, is_type, type; | ||
type = function(x) { | ||
@@ -23,2 +23,8 @@ return Object.prototype.toString.call(x).slice(8, -1).toLowerCase(); | ||
context.test("instance_of"); | ||
is_string = function(x) { | ||
return x.trim != null; | ||
}; | ||
is_function = function(x) { | ||
return x.call != null; | ||
}; | ||
return module.exports = { | ||
@@ -28,3 +34,5 @@ deep_equal: deep_equal, | ||
is_type: is_type, | ||
instance_of: instance_of | ||
instance_of: instance_of, | ||
is_string: is_string, | ||
is_function: is_function | ||
}; | ||
@@ -31,0 +39,0 @@ }); |
{ | ||
"name": "fairmont", | ||
"version": "1.0.0-alpha-04", | ||
"version": "1.0.0-alpha-05", | ||
"description": "A collection of useful functions and utilities.", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -41,2 +41,3 @@ # Fairmont | ||
> | ||
@@ -52,2 +53,3 @@ identity, wrap, curry, _, partial, flip, | ||
> | ||
@@ -62,2 +64,3 @@ f_and, f_or, f_not, f_eq, f_neq | ||
> | ||
@@ -73,2 +76,3 @@ gt, lt, gte, lte, add, sub, mul, div, mod, | ||
> | ||
@@ -83,2 +87,3 @@ deep_equal, type, is_type, instance_of | ||
> | ||
@@ -95,2 +100,3 @@ fold, foldr, map, filter, any, all, each, cat, slice, | ||
> | ||
@@ -105,4 +111,6 @@ md5, base64, base64url | ||
> | ||
exists, stat, read, readdir, write, chdir, rm, rmdir | ||
exists, stat, read, readdir, read_stream, read_block, lines, | ||
write, chdir, rm, rmdir | ||
@@ -115,2 +123,3 @@ [fs]:src/fs.litcoffee | ||
> | ||
@@ -125,2 +134,3 @@ include/extend, merge, clone, pluck, property, delegate, bind, detach | ||
> | ||
@@ -136,4 +146,5 @@ capitalize, title_case, camel_case, underscored, | ||
> | ||
shell, sleep, timer, memoize, abort | ||
times, shell, sleep, timer, memoize, abort | ||
@@ -140,0 +151,0 @@ [misc]:src/index.litcoffee |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85249
26
1572
162