Comparing version 1.0.0-alpha-17 to 1.0.0-alpha-18
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var _, assert, binary, compose, curry, deep_equal, describe, detach, flip, identity, lt, odd, partial, ref, ref1, ref2, ternary, unary, | ||
var _, assert, binary, compose, curry, deep_equal, describe, detach, empty, flip, identity, lt, odd, partial, ref, ref1, ref2, ternary, unary, | ||
slice1 = [].slice, | ||
@@ -13,2 +13,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; }; | ||
empty = function(x) { | ||
return x.length === 0; | ||
}; | ||
ref1 = require("./numeric"), odd = ref1.odd, lt = ref1.lt; | ||
@@ -19,6 +23,3 @@ | ||
describe("Array functions", function(context) { | ||
var cat, difference, dupes, empty, first, includes, intersection, last, range, remove, rest, second, shuffle, slice, third, union, uniq, unique, unique_by; | ||
empty = function(ax) { | ||
return ax.length === 0; | ||
}; | ||
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); | ||
@@ -205,3 +206,2 @@ context.test("cat", function() { | ||
slice: slice, | ||
empty: empty, | ||
first: first, | ||
@@ -208,0 +208,0 @@ second: second, |
@@ -170,6 +170,6 @@ // Generated by CoffeeScript 1.9.1 | ||
}); | ||
variadic = function() { | ||
var ax; | ||
ax = 1 <= arguments.length ? slice.call(arguments, 0) : []; | ||
return ax; | ||
variadic = function(f) { | ||
return function(ax) { | ||
return f.apply(null, ax); | ||
}; | ||
}; | ||
@@ -176,0 +176,0 @@ unary = function(f) { |
@@ -8,3 +8,3 @@ // Generated by CoffeeScript 1.9.1 | ||
describe("General functions", function(context) { | ||
var abort, curry, include, memoize, shell, sleep, timer, times; | ||
var abort, async, benchmark, blank, curry, empty, include, is_array, is_function, is_generator, is_object, keys, memoize, ref1, ref2, shell, sleep, timer, times; | ||
abort = function() { | ||
@@ -86,2 +86,31 @@ return process.exit(-1); | ||
}); | ||
ref1 = require("./type"), is_function = ref1.is_function, is_generator = ref1.is_generator; | ||
async = require("./generator").async; | ||
benchmark = async(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; | ||
} | ||
}); | ||
context.test("benchmark"); | ||
keys = require("./object").keys; | ||
ref2 = require("./type"), is_array = ref2.is_array, is_object = ref2.is_object; | ||
blank = require("./string").blank; | ||
empty = function(x) { | ||
if (is_array(x)) { | ||
return a.length === 0; | ||
} else if (is_object(x)) { | ||
return empty(keys(x)); | ||
} else if (is_string(x)) { | ||
return blank(x); | ||
} else { | ||
return x != null; | ||
} | ||
}; | ||
module.exports = { | ||
@@ -93,3 +122,6 @@ times: times, | ||
memoize: memoize, | ||
abort: abort | ||
abort: abort, | ||
times: times, | ||
benchmark: benchmark, | ||
empty: empty | ||
}; | ||
@@ -96,0 +128,0 @@ include = require("./object").include; |
@@ -10,3 +10,3 @@ // Generated by CoffeeScript 1.9.1 | ||
describe("Type functions", function(context) { | ||
var instance_of, is_array, is_function, is_object, is_string, is_type, is_value, type; | ||
var instance_of, is_array, is_boolean, is_date, is_function, is_generator, is_number, is_object, is_regexp, is_string, is_type, is_value, type; | ||
type = function(x) { | ||
@@ -24,9 +24,59 @@ return Object.prototype.toString.call(x).slice(8, -1).toLowerCase(); | ||
context.test("instance_of"); | ||
is_number = is_type("number"); | ||
context.test("is_number", function() { | ||
assert(is_number(7)); | ||
return assert(!is_number(false)); | ||
}); | ||
is_boolean = is_type("boolean"); | ||
context.test("is_boolean", function() { | ||
assert(is_boolean(true)); | ||
return assert(!is_boolean(7)); | ||
}); | ||
is_date = is_type("date"); | ||
context.test("is_date", function() { | ||
assert(is_date(new Date)); | ||
return assert(!is_date(7)); | ||
}); | ||
is_regexp = is_type("regexp"); | ||
context.test("is_regexp", function() { | ||
assert(is_regexp(/\s/)); | ||
return assert(!is_regexp(7)); | ||
}); | ||
is_string = is_type("string"); | ||
context.test("is_string", function() { | ||
assert(is_string("x")); | ||
return assert(!is_string(7)); | ||
}); | ||
is_function = is_type("function"); | ||
context.test("is_function", function() { | ||
assert(is_function(function() {})); | ||
return assert(!is_function(7)); | ||
}); | ||
is_generator = function(x) { | ||
return x.constructor.name === "GeneratorFunction"; | ||
}; | ||
context.test("is_generator", function() { | ||
var f; | ||
f = function*() { | ||
return (yield true); | ||
}; | ||
return assert(is_generator(f)); | ||
}); | ||
is_object = is_type("object"); | ||
context.test("is_object", function() { | ||
assert(is_object({})); | ||
return assert(!is_object(7)); | ||
}); | ||
is_array = is_type("array"); | ||
context.test("is_array", function() { | ||
assert(is_array([])); | ||
return assert(!is_array(7)); | ||
}); | ||
is_value = function(x) { | ||
return x != null; | ||
}; | ||
context.test("is_value", function() { | ||
assert(is_value({})); | ||
return assert(!is_value(void 0)); | ||
}); | ||
return module.exports = { | ||
@@ -37,4 +87,7 @@ deep_equal: deep_equal, | ||
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, | ||
@@ -41,0 +94,0 @@ is_array: is_array, |
{ | ||
"name": "fairmont", | ||
"version": "1.0.0-alpha-17", | ||
"version": "1.0.0-alpha-18", | ||
"description": "A collection of useful functions and utilities.", | ||
@@ -14,4 +14,5 @@ "files": [ | ||
"test": "coffee --nodejs --harmony test/test.litcoffee", | ||
"watch": "coffee --nodejs --harmony -o lib/ -cw src/*.*coffee" | ||
}, | ||
"watch": "coffee --nodejs --harmony -o lib/ -cw src/*.*coffee", | ||
"tag": "(node_modules/.bin/json -f package.json version | xargs -I version git tag -am version version) && git push --tags" | ||
}, | ||
"repository": { | ||
@@ -18,0 +19,0 @@ "type": "git", |
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
106642
2012