Socket
Socket
Sign inDemoInstall

fairmont

Package Overview
Dependencies
6
Maintainers
3
Versions
90
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-beta-12 to 1.0.0-beta-13

38

lib/array.js
// Generated by CoffeeScript 1.9.3
(function() {
var _, assert, binary, compose, curry, deep_equal, describe, detach, empty, flip, identity, lt, odd, partial, ref, ref1, ref2, ternary, unary,
var _, assert, binary, compose, curry, deepEqual, describe, detach, empty, flip, identity, lt, odd, partial, ref, ref1, ref2, ternary, unary,
slice1 = [].slice,

@@ -11,3 +11,3 @@ 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; };

deep_equal = require("./type").deep_equal;
deepEqual = require("./type").deepEqual;

@@ -23,3 +23,3 @@ empty = function(x) {

describe("Array functions", function(context) {
var cat, complement, difference, dupes, first, includes, intersection, last, range, remove, rest, second, shuffle, slice, third, union, uniq, unique, unique_by;
var cat, complement, difference, dupes, first, includes, intersection, last, range, remove, rest, second, shuffle, slice, third, union, uniq, unique, uniqueBy;
cat = detach(Array.prototype.concat);

@@ -29,4 +29,4 @@ context.test("cat", function() {

data = [1, 2, 3, 4, 5];
assert(deep_equal(cat(data), data));
return assert(deep_equal(cat(data, data), data.concat(data)));
assert(deepEqual(cat(data), data));
return assert(deepEqual(cat(data, data), data.concat(data)));
});

@@ -39,3 +39,3 @@ slice = curry(function(i, j, ax) {

data = [1, 2, 3, 4, 5];
return assert(deep_equal((slice(1, 2))(data), [2]));
return assert(deepEqual((slice(1, 2))(data), [2]));
});

@@ -69,3 +69,3 @@ first = function(ax) {

return (function(data) {
return assert(deep_equal(rest(data), [2, 3, 4, 5]));
return assert(deepEqual(rest(data), [2, 3, 4, 5]));
})([1, 2, 3, 4, 5]);

@@ -82,3 +82,3 @@ });

});
unique_by = curry(function(f, ax) {
uniqueBy = curry(function(f, ax) {
var a, b, bx, k, len;

@@ -95,5 +95,5 @@ bx = [];

});
unique = uniq = unique_by(identity);
unique = uniq = uniqueBy(identity);
context.test("unique", function() {
return assert(deep_equal(unique(cat([1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5])), [1, 2, 3, 4, 5]));
return assert(deepEqual(unique(cat([1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5])), [1, 2, 3, 4, 5]));
});

@@ -115,3 +115,3 @@ dupes = function(arg) {

context.test("dupes", function() {
return assert(deep_equal(dupes(cat([1, 2, 3], [2, 3, 4], [3, 4, 5])), [2, 3, 4]));
return assert(deepEqual(dupes(cat([1, 2, 3], [2, 3, 4], [3, 4, 5])), [2, 3, 4]));
});

@@ -121,4 +121,4 @@ union = curry(compose(unique, cat));

return (function(a, b) {
assert(deep_equal(union(a, b), [1, 2, 3, 4, 5, 6]));
return assert(deep_equal(union(a, a), [1, 2, 3, 4]));
assert(deepEqual(union(a, b), [1, 2, 3, 4, 5, 6]));
return assert(deepEqual(union(a, a), [1, 2, 3, 4]));
})([1, 2, 3, 4], [3, 4, 5, 6]);

@@ -161,3 +161,3 @@ });

return (function(ax, bx) {
return assert(deep_equal(difference(ax, bx), [1, 2, 5, 6]));
return assert(deepEqual(difference(ax, bx), [1, 2, 5, 6]));
})([1, 2, 3, 4], [3, 4, 5, 6]);

@@ -172,3 +172,3 @@ });

return (function(ax, bx) {
return assert(deep_equal(complement(ax, bx), [1, 2]));
return assert(deepEqual(complement(ax, bx), [1, 2]));
})([1, 2, 3, 4], [3, 4, 5, 6]);

@@ -197,3 +197,3 @@ });

}
if (deep_equal(ax, bx)) {
if (deepEqual(ax, bx)) {
return shuffle(ax);

@@ -209,3 +209,3 @@ } else {

return (function(data) {
return assert(!deep_equal(shuffle(data), data));
return assert(!deepEqual(shuffle(data), data));
})([1, 2, 3, 4, 5]);

@@ -222,3 +222,3 @@ });

context.test("range", function() {
return assert(deep_equal(range(1, 5), [1, 2, 3, 4, 5]));
return assert(deepEqual(range(1, 5), [1, 2, 3, 4, 5]));
});

@@ -234,3 +234,3 @@ return module.exports = {

includes: includes,
unique_by: unique_by,
uniqueBy: uniqueBy,
unique: unique,

@@ -237,0 +237,0 @@ uniq: uniq,

@@ -9,4 +9,4 @@ // Generated by CoffeeScript 1.9.3

describe("Functional programming functions", function(context) {
var _, binary, compose, curry, deep_equal, flip, identity, no_op, partial, pipe, ternary, unary, variadic, wrap;
deep_equal = function(a, b) {
var _, binary, compose, curry, deepEqual, flip, identity, noOp, partial, pipe, ternary, unary, variadic, wrap;
deepEqual = function(a, b) {
assert = require("assert");

@@ -20,4 +20,4 @@ try {

};
context.test("deep_equal", function() {
assert(deep_equal({
context.test("deepEqual", function() {
assert(deepEqual({
a: 1,

@@ -29,3 +29,3 @@ b: 2

}));
return assert(!deep_equal({
return assert(!deepEqual({
a: 1,

@@ -38,3 +38,3 @@ b: 2

});
no_op = function() {};
noOp = function() {};
identity = function(x) {

@@ -72,3 +72,3 @@ return x;

});
assert(deep_equal(f(1, 2, 3), {
assert(deepEqual(f(1, 2, 3), {
x: 1,

@@ -79,3 +79,3 @@ y: 2,

g = f(3, 2);
return assert(deep_equal(g(1), {
return assert(deepEqual(g(1), {
x: 3,

@@ -145,8 +145,8 @@ y: 2,

return function() {
var ax, f_ax, ref1;
var ax, fax, ref1;
ax = 1 <= arguments.length ? slice.call(arguments, 0) : [];
if (((ref1 = (f_ax = f.apply(null, ax))) != null ? ref1.then : void 0) != null) {
return f_ax.then(g);
if (((ref1 = (fax = f.apply(null, ax))) != null ? ref1.then : void 0) != null) {
return fax.then(g);
} else {
return g(f_ax);
return g(fax);
}

@@ -157,3 +157,3 @@ };

context.test("compose", function*() {
var _parse, _stringify, clone, clone_1, clone_2, clone_3, data, parse, promise, stringify;
var _parse, _stringify, clone, clone1, clone2, clone3, data, parse, promise, stringify;
data = {

@@ -166,3 +166,3 @@ foo: 1,

clone = compose(parse, stringify);
assert(deep_equal(clone(data), data));
assert(deepEqual(clone(data), data));
promise = require("when").promise;

@@ -183,8 +183,8 @@ _stringify = function(x) {

};
clone_1 = compose(parse, _stringify);
clone_2 = compose(_parse, stringify);
clone_3 = compose(_parse, _stringify);
assert(deep_equal((yield clone_1(data)), data));
assert(deep_equal((yield clone_2(data)), data));
return assert(deep_equal((yield clone_3(data)), data));
clone1 = compose(parse, _stringify);
clone2 = compose(_parse, stringify);
clone3 = compose(_parse, _stringify);
assert(deepEqual((yield clone1(data)), data));
assert(deepEqual((yield clone2(data)), data));
return assert(deepEqual((yield clone3(data)), data));
});

@@ -201,3 +201,3 @@ pipe = flip(compose);

clone = pipe(stringify, parse);
return assert(deep_equal(clone(data), data));
return assert(deepEqual(clone(data), data));
});

@@ -225,4 +225,4 @@ variadic = function(f) {

return module.exports = {
deep_equal: deep_equal,
no_op: no_op,
deepEqual: deepEqual,
noOp: noOp,
identity: identity,

@@ -229,0 +229,0 @@ wrap: wrap,

// Generated by CoffeeScript 1.9.3
(function() {
var FS, assert, async, describe, init, initFS, ref,
slice = [].slice,
var assert, async, describe, 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; };

@@ -9,32 +8,15 @@

FS = void 0;
initFS = function() {
return FS != null ? FS : FS = (function() {
var liftAll;
liftAll = require("when/node").liftAll;
return liftAll(require("fs"));
})();
};
init = function(f) {
return function() {
var ax;
ax = 1 <= arguments.length ? slice.call(arguments, 0) : [];
initFS();
return f.apply(null, ax);
};
};
ref = require("./helpers"), describe = ref.describe, assert = ref.assert;
describe("File system functions", function(context) {
var Minimatch, binary, chdir, curry, dirname, exist, exists, flatten, glob, is_directory, is_file, join, lines, ls, lsR, mkdir, mkdirp, read, read_buffer, read_stream, readdir, ref1, ref2, rm, rmdir, stat, stream, write;
stat = init(function(path) {
var FS, Method, Minimatch, binary, chDir, chdir, curry, dirname, exist, exists, flatten, glob, isDirectory, isFile, join, liftAll, ls, lsR, lsr, mkDir, mkDirP, mkdir, mkdirp, promise, read, readBuffer, readDir, readdir, ref1, ref2, rm, rmDir, rmdir, stat, stream, write;
liftAll = require("when/node").liftAll;
FS = liftAll(require("fs"));
stat = function(path) {
return FS.stat(path);
});
};
context.test("stat", function*() {
return assert(((yield stat("test/test.json"))).size != null);
return assert(((yield stat("test/lines.txt"))).size != null);
});
exists = exist = init(async(function*(path) {
exists = exist = async(function*(path) {
try {

@@ -46,39 +28,76 @@ (yield FS.stat(path));

}
}));
});
context.test("exists", function*() {
assert((yield exists("test/test.json")));
assert((yield exists("test/lines.txt")));
return assert(!((yield exists("test/does-not-exist"))));
});
read = init(async(function*(path, encoding) {
if (encoding == null) {
encoding = 'utf8';
}
return (yield FS.readFile(path, encoding));
}));
Method = require("./multimethods").Method;
read = Method.create();
Method.define(read, String, String, function(path, encoding) {
return FS.readFile(path, encoding);
});
Method.define(read, String, function(path) {
return read(path, 'utf8');
});
readBuffer = function(path) {
return FS.readFile(path);
};
Method.define(read, String, void 0, readBuffer);
Method.define(read, String, "binary", readBuffer);
Method.define(read, String, "buffer", readBuffer);
stream = require("stream");
promise = require("when").promise;
Method.define(read, stream.Readable, function(stream) {
var buffer;
buffer = "";
return promise(function(resolve, reject) {
stream.on("data", function(data) {
return buffer += data.toString();
});
stream.on("end", function() {
return resolve(buffer);
});
return stream.on("error", function(error) {
return reject(error);
});
});
});
context.test("read", function*() {
return assert((JSON.parse((yield read("test/test.json")))).name === "fairmont");
return assert(((yield read("test/lines.txt"))) === "one\ntwo\nthree\n");
});
read_buffer = init(async(function*(path) {
return (yield FS.readFile(path));
}));
context.test("read_buffer", function*() {
return assert(((yield read_buffer("test/test.json"))).constructor === Buffer);
context.test("read buffer", function*() {
return assert(((yield read("test/lines.txt", "binary"))).constructor === Buffer);
});
ls = readdir = init(function(path) {
context.test("read stream", function*() {
var createReadStream, s;
createReadStream = require("fs").createReadStream;
s = createReadStream("test/lines.txt");
return assert(((yield read(s))) === "one\ntwo\nthree\n");
});
readdir = readDir = function(path) {
return FS.readdir(path);
});
};
context.test("readdir", function*() {
return assert(indexOf.call((yield readdir("test")), "test.json") >= 0);
return assert(indexOf.call((yield readdir("test")), "lines.txt") >= 0);
});
ls = async(function*(path) {
var file, j, len, ref1, results;
ref1 = (yield readdir(path));
results = [];
for (j = 0, len = ref1.length; j < len; j++) {
file = ref1[j];
results.push(join(path, file));
}
return results;
});
flatten = require("./iterator").flatten;
join = require("path").join;
lsR = init(async(function*(path, visited) {
var childPath, file, i, info, len, ref1;
lsR = lsr = async(function*(path, visited) {
var childPath, info, j, len, ref1;
if (visited == null) {
visited = [];
}
ref1 = (yield readdir(path));
for (i = 0, len = ref1.length; i < len; i++) {
file = ref1[i];
childPath = join(path, file);
ref1 = (yield ls(path));
for (j = 0, len = ref1.length; j < len; j++) {
childPath = ref1[j];
if (!(indexOf.call(visited, childPath) >= 0)) {

@@ -94,3 +113,3 @@ info = (yield FS.lstat(childPath));

return visited;
}));
});
context.test("lsR", function*() {

@@ -100,7 +119,7 @@ var ref1, resolve, testDir;

testDir = join(__dirname, "..");
return assert((ref1 = join(testDir, "test/test.json"), indexOf.call((yield lsR(testDir)), ref1) >= 0));
return assert((ref1 = join(testDir, "test/lines.txt"), indexOf.call((yield lsR(testDir)), ref1) >= 0));
});
Minimatch = require("minimatch").Minimatch;
glob = init(async(function*(pattern, path) {
var _path, i, len, match, minimatch, ref1, results;
glob = async(function*(pattern, path) {
var _path, j, len, match, minimatch, ref1, results;
minimatch = new Minimatch(pattern);

@@ -112,4 +131,4 @@ match = function(path) {

results = [];
for (i = 0, len = ref1.length; i < len; i++) {
_path = ref1[i];
for (j = 0, len = ref1.length; j < len; j++) {
_path = ref1[j];
if (match(_path)) {

@@ -120,3 +139,3 @@ results.push(_path);

return results;
}));
});
context.test("glob", function*() {

@@ -127,36 +146,2 @@ var ref1, testDir;

});
read_stream = function(stream) {
var buffer, promise;
promise = require("when").promise;
buffer = "";
return promise(function(resolve, reject) {
stream.on("data", function(data) {
return buffer += data.toString();
});
stream.on("end", function() {
return resolve(buffer);
});
return stream.on("error", function(error) {
return reject(error);
});
});
};
context.test("read_stream", function() {
return (function*(lines) {
var Readable, promise, s;
Readable = require("stream").Readable;
s = new Readable;
promise = read(s);
s.push("one\n");
s.push("two\n");
s.push("three\n");
s.push(null);
lines = ((yield promise)).split("\n");
assert(lines.length === 3);
return assert(lines[0] === "one");
})(lines);
});
lines = function(stream) {
return (require("byline"))(stream);
};
stream = (function(arg) {

@@ -182,6 +167,11 @@ var promise, reject, resolve;

s.on("data", function(data) {
return _resolve(data.toString());
return _resolve({
value: data.toString(),
done: false
});
});
s.on("end", function() {
return _resolve(null);
return _resolve({
done: true
});
});

@@ -207,64 +197,67 @@ s.on("error", function() {

context.test("stream", function*() {
var Readable, _s, s;
Readable = require("stream").Readable;
s = new Readable;
_s = stream(lines(s));
s.push("one\n");
s.push("two\n");
s.push("three\n");
s.push(null);
assert(((yield _s())) === "one");
assert(((yield _s())) === "two");
return assert(((yield _s())) === "three");
var createReadStream, i;
createReadStream = require("fs").createReadStream;
i = stream(createReadStream("test/lines.txt"));
assert(((yield i())).value === "one\ntwo\nthree\n");
return assert(((yield i())).done);
});
write = init(function(path, content) {
write = function(path, content) {
return FS.writeFile(path, content);
});
};
context.test("write", function*() {
return write("test/test.json", (yield read("test/test.json")));
return write("test/lines.txt", (yield read("test/lines.txt")));
});
chdir = function(dir, fn) {
Method = require("./multimethods").Method;
chDir = chdir = Method.create();
Method.define(chdir, String, function(path) {
var cwd;
cwd = process.cwd();
process.chdir(dir);
fn();
return process.chdir(cwd);
};
process.chdir(path);
return function() {
return process.chdir(cwd);
};
});
Method.define(chdir, String, Function, function(path, f) {
var restore;
restore = chdir(path);
f();
return restore();
});
context.test("chdir", function() {
var cwd;
cwd = process.cwd();
chdir("test", function() {
chDir("test", function() {
var fs;
fs = require("fs");
return assert((fs.statSync("test.json")).size != null);
return assert((fs.statSync("lines.txt")).size != null);
});
return assert(cwd === process.cwd());
});
rm = init(async(function(path) {
rm = async(function(path) {
return FS.unlink(path);
}));
});
context.test("rm");
rmdir = init(function(path) {
rmDir = rmdir = function(path) {
return FS.rmdir(path);
});
};
context.test("rmdir", function() {});
is_directory = init(async(function*(path) {
isDirectory = async(function*(path) {
return ((yield stat(path))).isDirectory();
}));
context.test("is_directory", function*() {
return assert((yield is_directory("./test")));
});
is_file = init(async(function*(path) {
context.test("isDirectory", function*() {
return assert((yield isDirectory("./test")));
});
isFile = async(function*(path) {
return ((yield stat(path))).isFile();
}));
context.test("is_file", function*() {
return assert((yield is_file("./test/test.json")));
});
context.test("isFile", function*() {
return assert((yield isFile("./test/lines.txt")));
});
ref1 = require("./core"), curry = ref1.curry, binary = ref1.binary;
mkdir = curry(binary(init(function(mode, path) {
mkDir = mkdir = curry(binary(function(mode, path) {
return FS.mkdir(path, mode);
})));
}));
context.test("mdkir", function*() {
(yield mkdir('0777', "./test/foobar"));
assert((yield is_directory("./test/foobar")));
assert((yield isDirectory("./test/foobar")));
return (yield rmdir("./test/foobar"));

@@ -274,3 +267,3 @@ });

ref2 = require("./core"), curry = ref2.curry, binary = ref2.binary;
mkdirp = curry(binary(async(function*(mode, path) {
mkDirP = mkdirp = curry(binary(async(function*(mode, path) {
var parent;

@@ -287,3 +280,3 @@ if (!((yield exists(path)))) {

(yield mkdirp('0777', "./test/foo/bar"));
assert((yield is_directory("./test/foo/bar")));
assert((yield isDirectory("./test/foo/bar")));
(yield rmdir("./test/foo/bar"));

@@ -294,6 +287,4 @@ return (yield rmdir("./test/foo"));

read: read,
read_buffer: read_buffer,
write: write,
stream: stream,
lines: lines,
rm: rm,

@@ -303,9 +294,17 @@ stat: stat,

exists: exists,
is_file: is_file,
is_directory: is_directory,
isFile: isFile,
isDirectory: isDirectory,
readdir: readdir,
readDir: readDir,
ls: ls,
lsR: lsR,
lsr: lsr,
mkdir: mkdir,
mkDir: mkDir,
mkdirp: mkdirp,
mkDirP: mkDirP,
chdir: chdir,
rmdir: rmdir
chDir: chDir,
rmdir: rmdir,
rmDir: rmDir
};

@@ -312,0 +311,0 @@ });

@@ -8,3 +8,3 @@ // Generated by CoffeeScript 1.9.3

describe("General functions", function(context) {
var abort, async, benchmark, blank, curry, empty, include, is_array, is_function, is_generator, is_object, is_string, keys, length, memoize, ref1, ref2, shell, sleep, timer, times;
var Method, abort, async, benchmark, blank, curry, empty, include, isArray, isFunction, isGenerator, isObject, isString, keys, length, memoize, ref1, ref2, shell, sleep, timer, times;
abort = function(message) {

@@ -89,26 +89,28 @@ if (message != null) {

});
ref1 = require("./type"), is_function = ref1.is_function, is_generator = ref1.is_generator;
Method = require("./multimethods").Method;
ref1 = require("./type"), isFunction = ref1.isFunction, isGenerator = ref1.isGenerator;
async = require("./generator").async;
benchmark = async(function*(fn) {
benchmark = Method.create();
Method.define(benchmark, isFunction, function(fn) {
var start;
if (is_function(fn)) {
start = Date.now();
fn();
return Date.now() - start;
} else if (is_generator(fn)) {
start = Date.now();
(yield fn());
return Date.now() - start;
}
start = Date.now();
fn();
return Date.now() - start;
});
Method.define(benchmark, isGenerator, function*(fn) {
var start;
start = Date.now();
(yield fn());
return Date.now() - start;
});
context.test("benchmark");
keys = require("./object").keys;
ref2 = require("./type"), is_array = ref2.is_array, is_string = ref2.is_string, is_object = ref2.is_object;
ref2 = require("./type"), isArray = ref2.isArray, isString = ref2.isString, isObject = ref2.isObject;
blank = require("./string").blank;
empty = function(x) {
if (is_array(x)) {
if (isArray(x)) {
return x.length === 0;
} else if (is_object(x)) {
} else if (isObject(x)) {
return empty(keys(x));
} else if (is_string(x)) {
} else if (isString(x)) {
return blank(x);

@@ -115,0 +117,0 @@ } else {

@@ -21,20 +21,20 @@ // Generated by CoffeeScript 1.9.3

describe("Iterator functions", function(context) {
var _foldr, _unzip, add, all, any, assoc, average, binary, cat, collect, compact, delimit, detach, each, first, flatten, flip, fold, foldr, is_function, is_iterable, is_iterator, is_value, iterate, iterator, join, last, leave, map, negate, partition, project, property, query, ref2, reject, repeat, sample, second, select, skip, sum, take, ternary, third, unzip, w, where, wrap, zip;
is_iterable = function(x) {
var _foldr, _unzip, add, all, any, assoc, average, binary, cat, collect, compact, delimit, detach, each, first, flatten, flip, fold, foldr, isDefined, isFunction, isIterable, isIterator, iterate, iterator, join, last, leave, lines, map, negate, partition, project, property, query, ref2, reject, repeat, sample, second, select, skip, split, sum, take, ternary, third, unzip, w, where, wrap, zip;
isIterable = function(x) {
return x[Symbol.iterator] != null;
};
context.test("is_iterable", function() {
return assert(is_iterable([1, 2, 3]));
context.test("isIterable", function() {
return assert(isIterable([1, 2, 3]));
});
is_iterator = function(x) {
isIterator = function(x) {
return (x != null ? x.next : void 0) != null;
};
is_function = require("./type").is_function;
isFunction = require("./type").isFunction;
wrap = require("./core").wrap;
iterator = function(x) {
if (is_iterable(x)) {
if (isIterable(x)) {
return x[Symbol.iterator]();
} else if (is_iterator(x)) {
} else if (isIterator(x)) {
return x;
} else if ((is_function(x)) && (x.length === 0)) {
} else if ((isFunction(x)) && (x.length === 0)) {
return {

@@ -49,7 +49,7 @@ next: x

};
context.test("is_iterator", function() {
return assert(is_iterator(iterator([1, 2, 3])));
context.test("isIterator", function() {
return assert(isIterator(iterator([1, 2, 3])));
});
context.test("iterator", function() {
return assert(is_function((iterator([1, 2, 3])).next));
return assert(isFunction((iterator([1, 2, 3])).next));
});

@@ -73,3 +73,3 @@ iterate = function(x) {

i = iterate([1, 2, 3]);
assert(is_iterable(i));
assert(isIterable(i));
assert(((yield i())).value === 1);

@@ -286,5 +286,5 @@ assert(((yield i())).value === 2);

context.test("unzip", function() {
var first, to_string;
var first, toString;
first = require("./array").first;
to_string = require("./string").to_string;
toString = require("./string").toString;
return assert((fold("", add, first(collect(unzip(zip("panama", "canary")))))) === "panama");

@@ -333,4 +333,4 @@ });

});
is_value = require("./type").is_value;
compact = select(is_value);
isDefined = require("./type").isDefined;
compact = select(isDefined);
context.test("compact", function() {

@@ -465,6 +465,50 @@ return assert((second(collect(compact([1, null, null, 2])))) === 2);

});
split = curry(function(f, i) {
var done, lines;
lines = [];
done = false;
return async(function*() {
var k, len, line, ref3, ref4, value;
if (done) {
({
done: done
});
} else if (lines.length > 0) {
lines.shift();
} else {
ref3 = (yield i()), value = ref3.value, done = ref3.done;
if (!done) {
ref4 = f(value);
for (k = 0, len = ref4.length; k < len; k++) {
line = ref4[k];
if (value !== "") {
lines.push({
value: line,
done: false
});
}
}
}
}
return lines.shift();
});
});
context.test("split");
lines = split(function(s) {
return s.split("\n");
});
context.test("lines", function*() {
var createReadStream, i, stream;
stream = require("./fs").stream;
createReadStream = require("fs").createReadStream;
i = lines(stream(createReadStream("test/lines.txt")));
assert(((yield i())).value === "one");
assert(((yield i())).value === "two");
assert(((yield i())).value === "three");
return assert(((yield i())).done);
});
return module.exports = {
is_iterable: is_iterable,
isIterable: isIterable,
iterator: iterator,
is_iterator: is_iterator,
isIterator: isIterator,
iterate: iterate,

@@ -471,0 +515,0 @@ collect: collect,

@@ -26,3 +26,3 @@ // Generated by CoffeeScript 1.9.3

p += 5;
} else if (term.constructor === Function) {
} else if ((term != null ? term.constructor : void 0) === Function) {
if (term === arg.constructor) {

@@ -198,3 +198,3 @@ p += 4;

});
return context.test("Class methods", function() {
context.test("Class methods", function() {
var A, B, foo;

@@ -223,4 +223,7 @@ A = (function() {

});
return context.test("Multimethods are functions, too", function() {
return assert(Method.create().constructor === Function);
});
});
}).call(this);
// Generated by CoffeeScript 1.9.3
(function() {
var assert, compose, curry, deep_equal, describe, ref, ref1,
var assert, compose, curry, deepEqual, describe, ref, ref1,
slice = [].slice,

@@ -11,6 +11,6 @@ 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; };

deep_equal = require("./type").deep_equal;
deepEqual = require("./type").deepEqual;
describe("Object functions", function(context) {
var bind, clone, delegate, detach, extend, from_json, has, include, is_object, keys, merge, negate, omit, pairs, pick, properties, property, query, to_json, values;
var bind, clone, delegate, detach, extend, fromJson, has, include, isObject, keys, merge, negate, omit, pairs, pick, properties, property, query, toJson, values;
include = extend = function() {

@@ -74,4 +74,4 @@ var i, key, len, mixin, mixins, object, value;

context.test("clone", function() {
var is_clone, person;
is_clone = function(original, copy) {
var isClone, person;
isClone = function(original, copy) {
assert.notEqual(original, copy);

@@ -90,3 +90,3 @@ return assert.deepEqual(original, copy);

};
return is_clone(person, clone(person));
return isClone(person, clone(person));
});

@@ -97,3 +97,3 @@ property = curry(function(key, object) {

context.test("property", function() {
var a, baz_foo;
var a, bazFoo;
a = {

@@ -107,4 +107,4 @@ foo: 1,

assert((property("foo", a)) === 1);
baz_foo = compose(property("foo"), property("baz"));
return assert((baz_foo(a)) === 2);
bazFoo = compose(property("foo"), property("baz"));
return assert((bazFoo(a)) === 2);
});

@@ -228,3 +228,3 @@ delegate = function(from, to) {

context.test("pairs", function() {
return assert(deep_equal(pairs({
return assert(deepEqual(pairs({
a: 1,

@@ -247,3 +247,3 @@ b: 2,

context.test("pick", function() {
return assert(deep_equal(pick((function(k, v) {
return assert(deepEqual(pick((function(k, v) {
return v != null;

@@ -264,3 +264,3 @@ }), {

context.test("omit", function() {
return assert(deep_equal(omit((function(k, v) {
return assert(deepEqual(omit((function(k, v) {
return v != null;

@@ -275,6 +275,6 @@ }), {

});
is_object = require("./type").is_object;
isObject = require("./type").isObject;
query = curry(function(example, target) {
var k, v;
if ((is_object(example)) && (is_object(target))) {
if ((isObject(example)) && (isObject(target))) {
for (k in example) {

@@ -288,8 +288,8 @@ v = example[k];

} else {
return deep_equal(example, target);
return deepEqual(example, target);
}
});
context.test("query", function() {
var snow_white;
snow_white = {
var snowWhite;
snowWhite = {
name: "Snow White",

@@ -301,14 +301,14 @@ dwarves: 7,

name: "Snow White"
}, snow_white));
}, snowWhite));
assert(query({
enemies: ["Evil Queen"]
}, snow_white));
}, snowWhite));
assert(!query({
name: "Sleeping Beauty"
}, snow_white));
}, snowWhite));
return assert(!query({
enemies: ["Maleficent"]
}, snow_white));
}, snowWhite));
});
to_json = function(x, pretty) {
toJson = function(x, pretty) {
if (pretty == null) {

@@ -323,3 +323,3 @@ pretty = false;

};
from_json = JSON.parse;
fromJson = JSON.parse;
return module.exports = {

@@ -342,4 +342,4 @@ include: include,

query: query,
to_json: to_json,
from_json: from_json
toJson: toJson,
fromJson: fromJson
};

@@ -346,0 +346,0 @@ });

@@ -8,13 +8,13 @@ // Generated by CoffeeScript 1.9.3

describe("String functions", function(context) {
var blank, camel_case, capitalize, dashed, html_escape, plain_text, title_case, to_lower, to_string, to_upper, underscored, w;
to_string = function(x) {
var blank, camelCase, capitalize, dashed, htmlEscape, plainText, titleCase, toLower, toString, toUpper, underscored, w;
toString = function(x) {
return x.toString();
};
to_upper = function(s) {
toUpper = function(s) {
return s.toUpperCase();
};
to_lower = function(s) {
toLower = function(s) {
return s.toLowerCase();
};
plain_text = function(string) {
plainText = function(string) {
return string.replace(/^[A-Z]/g, function(c) {

@@ -26,5 +26,5 @@ return c.toLowerCase();

};
context.test("plain_text", function() {
assert(plain_text("hello-world") === "hello world");
return assert(plain_text("Hello World") === "hello world");
context.test("plainText", function() {
assert(plainText("hello-world") === "hello world");
return assert(plainText("Hello World") === "hello world");
});

@@ -37,3 +37,3 @@ capitalize = function(string) {

});
title_case = function(string) {
titleCase = function(string) {
return string.toLowerCase().replace(/^(\w)|\W(\w)/g, function(char) {

@@ -43,6 +43,6 @@ return char.toUpperCase();

};
context.test("title_case", function() {
return assert(title_case("hello woRld") === "Hello World");
context.test("titleCase", function() {
return assert(titleCase("hello woRld") === "Hello World");
});
camel_case = function(string) {
camelCase = function(string) {
return string.toLowerCase().replace(/(\W+\w)/g, function(string) {

@@ -52,7 +52,7 @@ return string.trim().toUpperCase();

};
context.test("camel_case", function() {
return assert(camel_case("Hello World") === "helloWorld");
context.test("camelCase", function() {
return assert(camelCase("Hello World") === "helloWorld");
});
underscored = function(string) {
return plain_text(string).replace(/\W+/g, "_");
return plainText(string).replace(/\W+/g, "_");
};

@@ -63,3 +63,3 @@ context.test("underscored", function() {

dashed = function(string) {
return plain_text(string).replace(/\W+/g, "-");
return plainText(string).replace(/\W+/g, "-");
};

@@ -69,3 +69,3 @@ context.test("dashed", function() {

});
html_escape = (function() {
htmlEscape = (function() {
var entities, map, re;

@@ -88,4 +88,4 @@ map = {

})();
context.test("html_escape", function() {
return assert.equal(html_escape("<a href='foo'>bar & baz</a>"), "&lt;a href=&#39;foo&#39;&gt;bar &amp; baz&lt;&#x2F;a&gt;");
context.test("htmlEscape", function() {
return assert.equal(htmlEscape("<a href='foo'>bar & baz</a>"), "&lt;a href=&#39;foo&#39;&gt;bar &amp; baz&lt;&#x2F;a&gt;");
});

@@ -106,12 +106,12 @@ w = function(string) {

return module.exports = {
to_string: to_string,
to_upper: to_upper,
to_lower: to_lower,
toString: toString,
toUpper: toUpper,
toLower: toLower,
capitalize: capitalize,
title_case: title_case,
camel_case: camel_case,
titleCase: titleCase,
camelCase: camelCase,
underscored: underscored,
dashed: dashed,
plain_text: plain_text,
html_escape: html_escape,
plainText: plainText,
htmlEscape: htmlEscape,
w: w,

@@ -118,0 +118,0 @@ blank: blank

// Generated by CoffeeScript 1.9.3
(function() {
var assert, curry, deep_equal, describe, ref, ref1;
var assert, curry, deepEqual, describe, ref, ref1;
ref = require("./core"), curry = ref.curry, deep_equal = ref.deep_equal;
ref = require("./core"), curry = ref.curry, deepEqual = ref.deepEqual;

@@ -10,70 +10,75 @@ ref1 = require("./helpers"), describe = ref1.describe, assert = ref1.assert;

describe("Type functions", function(context) {
var instance_of, is_array, is_boolean, is_date, is_float, is_function, is_generator, is_integer, is_number, is_object, is_regexp, is_string, is_type, is_value, type;
var GeneratorFunction, instanceOf, isArray, isBoolean, isDate, isDefined, isFinite, isFloat, isFunction, isGenerator, isInteger, isNaN, isNumber, isObject, isRegexp, isString, isType, type;
type = function(x) {
return Object.prototype.toString.call(x).slice(8, -1).toLowerCase();
return x != null ? x.constructor : void 0;
};
context.test("type");
is_type = curry(function(t, x) {
isType = curry(function(t, x) {
return type(x) === t;
});
context.test("is_type");
instance_of = curry(function(t, x) {
context.test("isType");
instanceOf = curry(function(t, x) {
return x instanceof t;
});
context.test("instance_of");
is_number = function(n) {
return n === +n;
};
context.test("is_number", function() {
assert(is_number(7));
assert(!is_number("7"));
return assert(!is_number(false));
context.test("instanceOf");
isNumber = isType(Number);
context.test("isNumber", function() {
assert(isNumber(7));
assert(!isNumber("7"));
return assert(!isNumber(false));
});
is_integer = function(n) {
return n === +n && n === (n | 0);
isNaN = function(n) {
return Number.isNaN(n);
};
context.test("is_integer", function() {
assert(is_integer(5));
assert(!is_integer(3.5));
assert(!is_integer("5"));
return assert(!is_integer(NaN));
isFinite = function(n) {
return Number.isFinite(n);
};
isInteger = function(n) {
return Number.isInteger(n);
};
context.test("isInteger", function() {
assert(isInteger(5));
assert(!isInteger(3.5));
assert(!isInteger("5"));
return assert(!isInteger(NaN));
});
is_float = function(n) {
isFloat = function(n) {
return n === +n && n !== (n | 0);
};
context.test("is_float", function() {
assert(is_float(3.5));
assert(!is_float(5));
assert(!is_float("3.5"));
return assert(!is_float(NaN));
context.test("isFloat", function() {
assert(isFloat(3.5));
assert(!isFloat(5));
assert(!isFloat("3.5"));
return assert(!isFloat(NaN));
});
is_boolean = is_type("boolean");
context.test("is_boolean", function() {
assert(is_boolean(true));
return assert(!is_boolean(7));
isBoolean = isType(Boolean);
context.test("isBoolean", function() {
assert(isBoolean(true));
return assert(!isBoolean(7));
});
is_date = is_type("date");
context.test("is_date", function() {
assert(is_date(new Date));
return assert(!is_date(7));
isDate = isType(Date);
context.test("isDate", function() {
assert(isDate(new Date));
return assert(!isDate(7));
});
is_regexp = is_type("regexp");
context.test("is_regexp", function() {
assert(is_regexp(/\s/));
return assert(!is_regexp(7));
isRegexp = isType(RegExp);
context.test("isRegexp", function() {
assert(isRegexp(/\s/));
return assert(!isRegexp(7));
});
is_string = is_type("string");
context.test("is_string", function() {
assert(is_string("x"));
return assert(!is_string(7));
isString = isType(String);
context.test("isString", function() {
assert(isString("x"));
return assert(!isString(7));
});
is_function = is_type("function");
context.test("is_function", function() {
assert(is_function(function() {}));
return assert(!is_function(7));
isFunction = isType(Function);
context.test("isFunction", function() {
assert(isFunction(function() {}));
return assert(!isFunction(7));
});
is_generator = function(x) {
return x.constructor.name === "GeneratorFunction";
};
context.test("is_generator", function() {
GeneratorFunction = (function*() {
return (yield null);
}).constructor;
isGenerator = isType(GeneratorFunction);
context.test("isGenerator", function() {
var f;

@@ -83,34 +88,38 @@ f = function*() {

};
return assert(is_generator(f));
return assert(isGenerator(f));
});
is_object = is_type("object");
context.test("is_object", function() {
assert(is_object({}));
return assert(!is_object(7));
isObject = isType(Object);
context.test("isObject", function() {
assert(isObject({}));
return assert(!isObject(7));
});
is_array = is_type("array");
context.test("is_array", function() {
assert(is_array([]));
return assert(!is_array(7));
isArray = isType(Array);
context.test("isArray", function() {
assert(isArray([]));
return assert(!isArray(7));
});
is_value = function(x) {
isDefined = function(x) {
return x != null;
};
context.test("is_value", function() {
assert(is_value({}));
return assert(!is_value(void 0));
context.test("isDefined", function() {
assert(isDefined({}));
return assert(!isDefined(void 0));
});
return module.exports = {
deep_equal: deep_equal,
deepEqual: deepEqual,
type: type,
is_type: is_type,
instance_of: instance_of,
is_boolean: is_boolean,
is_number: is_number,
is_string: is_string,
is_function: is_function,
is_generator: is_generator,
is_object: is_object,
is_array: is_array,
is_value: is_value
isType: isType,
instanceOf: instanceOf,
isBoolean: isBoolean,
isNumber: isNumber,
isNaN: isNaN,
isFinite: isFinite,
isInteger: isInteger,
isFloat: isFloat,
isString: isString,
isFunction: isFunction,
isGenerator: isGenerator,
isObject: isObject,
isArray: isArray,
isDefined: isDefined
};

@@ -117,0 +126,0 @@ });

{
"name": "fairmont",
"version": "1.0.0-beta-12",
"version": "1.0.0-beta-13",
"description": "A collection of useful functions and utilities.",

@@ -5,0 +5,0 @@ "files": [

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc