functional.js
Advanced tools
Comparing version 0.4.12 to 0.5.0
@@ -6,3 +6,3 @@ { | ||
"homepage": "http://functionaljs.com", | ||
"version": "0.4.12", | ||
"version": "0.5.0", | ||
"keywords": [ | ||
@@ -14,7 +14,6 @@ "functional", | ||
"iterator", | ||
"collection", | ||
"lambda", | ||
"underscore" | ||
], | ||
"main": "functional.min.client.js", | ||
"main": "functional.min.js", | ||
"ignore" : [ | ||
@@ -27,4 +26,4 @@ ".gitignore", | ||
"README.md", | ||
"spec.js", | ||
"spec.js" | ||
] | ||
} |
@@ -6,3 +6,3 @@ { | ||
"homepage": "http://functionaljs.com", | ||
"version": "0.4.12", | ||
"version": "0.5.0", | ||
"keywords": [ | ||
@@ -14,3 +14,2 @@ "functional", | ||
"iterator", | ||
"collection", | ||
"lambda", | ||
@@ -20,5 +19,4 @@ "underscore" | ||
"repo": "leecrossley/functional-js", | ||
"main": "functional.min.client.js", | ||
"main": "functional.min.js", | ||
"scripts": [ | ||
"functional.min.client.js", | ||
"functional.min.js", | ||
@@ -25,0 +23,0 @@ "functional.js" |
@@ -1,5 +0,6 @@ | ||
var λ = (function () { | ||
var fjs = (function () { | ||
"use strict"; | ||
var λ = {}, hardReturn = "hardReturn;"; | ||
var fjs = {}, hardReturn = "hardReturn;"; | ||
var sliceArgs = function (args) { | ||
@@ -9,3 +10,3 @@ return args.length > 0 ? [].slice.call(args, 0) : []; | ||
λ.isFunction = function (obj) { | ||
fjs.isFunction = function (obj) { | ||
return typeof (obj) === "function"; | ||
@@ -15,8 +16,8 @@ }; | ||
var checkFunction = function (func) { | ||
if (!λ.isFunction(func)) { | ||
throw "λ Error: Invalid function"; | ||
if (!fjs.isFunction(func)) { | ||
throw "fjs Error: Invalid function"; | ||
} | ||
}; | ||
λ.curry = function (func) { | ||
fjs.curry = function (func) { | ||
checkFunction(func); | ||
@@ -29,3 +30,3 @@ return function inner() { | ||
var initial = func.apply(null, _args); | ||
return λ.fold(func, initial, _args.slice(func.length)); | ||
return fjs.fold(func, initial, _args.slice(func.length)); | ||
} else { | ||
@@ -40,5 +41,5 @@ return function() { | ||
λ.each = λ.curry(function (iterator, items) { | ||
fjs.each = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
if (!λ.exists(items) || !λ.isArray(items)) { | ||
if (!fjs.exists(items) || !fjs.isArray(items)) { | ||
return; | ||
@@ -53,6 +54,6 @@ } | ||
λ.map = λ.curry(function (iterator, items) { | ||
fjs.map = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
var mapped = []; | ||
λ.each(function () { | ||
fjs.each(function () { | ||
mapped.push(iterator.apply(null, arguments)); | ||
@@ -63,5 +64,5 @@ }, items); | ||
λ.fold = λ.foldl = λ.curry(function (iterator, cumulate, items) { | ||
fjs.fold = fjs.foldl = fjs.curry(function (iterator, cumulate, items) { | ||
checkFunction(iterator); | ||
λ.each(function (item) { | ||
fjs.each(function (item) { | ||
cumulate = iterator.call(null, cumulate, item); | ||
@@ -72,12 +73,12 @@ }, items); | ||
λ.reduce = λ.reducel = λ.foldll = λ.curry(function (iterator, items) { | ||
fjs.reduce = fjs.reducel = fjs.foldll = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
var cumulate = items[0]; | ||
items.shift(); | ||
return λ.fold(iterator, cumulate, items); | ||
return fjs.fold(iterator, cumulate, items); | ||
}); | ||
λ.clone = function (items) { | ||
fjs.clone = function (items) { | ||
var clone = []; | ||
λ.each(function (item) { | ||
fjs.each(function (item) { | ||
clone.push(item); | ||
@@ -88,6 +89,6 @@ }, items); | ||
λ.first = λ.curry(function (iterator, items) { | ||
fjs.first = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
var first; | ||
λ.each(function (item) { | ||
fjs.each(function (item) { | ||
if (iterator.call(null, item)) { | ||
@@ -101,11 +102,11 @@ first = item; | ||
λ.last = λ.curry(function (iterator, items) { | ||
var itemsClone = λ.clone(items); | ||
return λ.first(iterator, itemsClone.reverse()); | ||
fjs.last = fjs.curry(function (iterator, items) { | ||
var itemsClone = fjs.clone(items); | ||
return fjs.first(iterator, itemsClone.reverse()); | ||
}); | ||
λ.every = λ.all = λ.curry(function (iterator, items) { | ||
fjs.every = fjs.all = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
var isEvery = true; | ||
λ.each(function (item) { | ||
fjs.each(function (item) { | ||
if (!iterator.call(null, item)) { | ||
@@ -119,6 +120,6 @@ isEvery = false; | ||
λ.any = λ.contains = λ.curry(function (iterator, items) { | ||
fjs.any = fjs.contains = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
var isAny = false; | ||
λ.each(function (item) { | ||
fjs.each(function (item) { | ||
if (iterator.call(null, item)) { | ||
@@ -132,6 +133,6 @@ isAny = true; | ||
λ.select = λ.filter = λ.curry(function (iterator, items) { | ||
fjs.select = fjs.filter = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
var filtered = []; | ||
λ.each(function (item) { | ||
fjs.each(function (item) { | ||
if (iterator.call(null, item)) { | ||
@@ -144,3 +145,3 @@ filtered.push(item); | ||
λ.best = λ.curry(function (iterator, items) { | ||
fjs.best = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
@@ -151,9 +152,9 @@ var compare = function (arg1, arg2) { | ||
}; | ||
return λ.reduce(compare, items); | ||
return fjs.reduce(compare, items); | ||
}); | ||
λ.while = λ.curry(function (iterator, items) { | ||
fjs.while = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
var result = []; | ||
λ.each(function (item) { | ||
fjs.each(function (item) { | ||
if (iterator.call(null, item)) { | ||
@@ -168,13 +169,13 @@ result.push(item); | ||
λ.compose = function (funcs) { | ||
var anyInvalid = λ.any(function (func) { | ||
return !λ.isFunction(func); | ||
fjs.compose = function (funcs) { | ||
var anyInvalid = fjs.any(function (func) { | ||
return !fjs.isFunction(func); | ||
}); | ||
funcs = sliceArgs(arguments); | ||
if (anyInvalid(funcs)) { | ||
throw "λ Error: Invalid function to compose"; | ||
throw "fjs Error: Invalid function to compose"; | ||
} | ||
return function() { | ||
var args = arguments; | ||
var applyEach = λ.each(function (func) { | ||
var applyEach = fjs.each(function (func) { | ||
args = [func.apply(null, args)]; | ||
@@ -187,7 +188,7 @@ }); | ||
λ.partition = λ.curry(function (iterator, items) { | ||
fjs.partition = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
var truthy = [], | ||
falsy = []; | ||
λ.each(function (item) { | ||
fjs.each(function (item) { | ||
(iterator.call(null, item) ? truthy : falsy).push(item); | ||
@@ -198,7 +199,7 @@ }, items); | ||
λ.group = λ.curry(function (iterator, items) { | ||
fjs.group = fjs.curry(function (iterator, items) { | ||
checkFunction(iterator); | ||
var result = {}; | ||
var group; | ||
λ.each(function (item) { | ||
fjs.each(function (item) { | ||
group = iterator.call(null, item); | ||
@@ -211,8 +212,8 @@ result[group] = result[group] || []; | ||
λ.isArray = function (obj) { | ||
fjs.isArray = function (obj) { | ||
return Object.prototype.toString.call(obj) === "[object Array]"; | ||
}; | ||
λ.toArray = function (obj) { | ||
return λ.map(function (key) { | ||
fjs.toArray = function (obj) { | ||
return fjs.map(function (key) { | ||
return [key, obj[key]]; | ||
@@ -222,9 +223,9 @@ }, Object.keys(obj)); | ||
λ.apply = λ.curry(function (func, items) { | ||
fjs.apply = fjs.curry(function (func, items) { | ||
var args = []; | ||
if (λ.isArray(func)) { | ||
if (fjs.isArray(func)) { | ||
args = [].slice.call(func, 1); | ||
func = func[0]; | ||
} | ||
return λ.map(function (item) { | ||
return fjs.map(function (item) { | ||
return item[func].apply(item, args); | ||
@@ -234,4 +235,4 @@ }, items); | ||
λ.assign = λ.extend = λ.curry(function (obj1, obj2) { | ||
λ.each(function (key) { | ||
fjs.assign = fjs.extend = fjs.curry(function (obj1, obj2) { | ||
fjs.each(function (key) { | ||
obj2[key] = obj1[key]; | ||
@@ -242,3 +243,3 @@ }, Object.keys(obj1)); | ||
λ.prop = function (prop) { | ||
fjs.prop = function (prop) { | ||
return function (obj) { | ||
@@ -249,19 +250,19 @@ return obj[prop]; | ||
λ.pluck = λ.curry(function (prop, items) { | ||
return λ.map(λ.prop(prop), items); | ||
fjs.pluck = fjs.curry(function (prop, items) { | ||
return fjs.map(fjs.prop(prop), items); | ||
}); | ||
λ.exists = function (obj) { | ||
fjs.exists = function (obj) { | ||
return obj != null; // jshint ignore:line | ||
}; | ||
λ.truthy = function (obj) { | ||
return λ.exists(obj) && obj !== false; | ||
fjs.truthy = function (obj) { | ||
return fjs.exists(obj) && obj !== false; | ||
}; | ||
λ.falsy = function (obj) { | ||
return !λ.truthy(obj); | ||
fjs.falsy = function (obj) { | ||
return !fjs.truthy(obj); | ||
}; | ||
return λ; | ||
return fjs; | ||
})(); | ||
@@ -271,5 +272,5 @@ | ||
if (typeof (module) !== "undefined" && module.exports) { | ||
exports = module.exports = λ; | ||
exports = module.exports = fjs; | ||
} | ||
exports.λ = λ; | ||
exports.fjs = fjs; | ||
} |
/*! | ||
functional.js (v0.4.12) 08-08-2014 | ||
functional.js (v0.5.0) 09-08-2014 | ||
(c) Lee Crossley <leee@hotmail.co.uk> (http://ilee.co.uk/) | ||
*/ | ||
var λ=function(){"use strict";var a={},b="hardReturn;",c=function(a){return a.length>0?[].slice.call(a,0):[]};a.isFunction=function(a){return"function"==typeof a};var d=function(b){if(!a.isFunction(b))throw"λ Error: Invalid function"};return a.curry=function(b){return d(b),function e(){var d=c(arguments);if(d.length===b.length)return b.apply(null,d);if(d.length>b.length){var f=b.apply(null,d);return a.fold(b,f,d.slice(b.length))}return function(){var a=c(arguments);return e.apply(null,d.concat(a))}}},a.each=a.curry(function(c,e){if(d(c),a.exists(e)&&a.isArray(e))for(var f=0;f<e.length;f+=1)if(c.call(null,e[f],f)===b)return}),a.map=a.curry(function(b,c){d(b);var e=[];return a.each(function(){e.push(b.apply(null,arguments))},c),e}),a.fold=a.foldl=a.curry(function(b,c,e){return d(b),a.each(function(a){c=b.call(null,c,a)},e),c}),a.reduce=a.reducel=a.foldll=a.curry(function(b,c){d(b);var e=c[0];return c.shift(),a.fold(b,e,c)}),a.clone=function(b){var c=[];return a.each(function(a){c.push(a)},b),c},a.first=a.curry(function(c,e){d(c);var f;return a.each(function(a){return c.call(null,a)?(f=a,b):void 0},e),f}),a.last=a.curry(function(b,c){var d=a.clone(c);return a.first(b,d.reverse())}),a.every=a.all=a.curry(function(c,e){d(c);var f=!0;return a.each(function(a){return c.call(null,a)?void 0:(f=!1,b)},e),f}),a.any=a.contains=a.curry(function(c,e){d(c);var f=!1;return a.each(function(a){return c.call(null,a)?(f=!0,b):void 0},e),f}),a.select=a.filter=a.curry(function(b,c){d(b);var e=[];return a.each(function(a){b.call(null,a)&&e.push(a)},c),e}),a.best=a.curry(function(b,c){d(b);var e=function(a,c){return b.call(this,a,c)?a:c};return a.reduce(e,c)}),a.while=a.curry(function(c,e){d(c);var f=[];return a.each(function(a){return c.call(null,a)?void f.push(a):b},e),f}),a.compose=function(b){var d=a.any(function(b){return!a.isFunction(b)});if(b=c(arguments),d(b))throw"λ Error: Invalid function to compose";return function(){var c=arguments,d=a.each(function(a){c=[a.apply(null,c)]});return d(b.reverse()),c[0]}},a.partition=a.curry(function(b,c){d(b);var e=[],f=[];return a.each(function(a){(b.call(null,a)?e:f).push(a)},c),[e,f]}),a.group=a.curry(function(b,c){d(b);var e,f={};return a.each(function(a){e=b.call(null,a),f[e]=f[e]||[],f[e].push(a)},c),f}),a.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)},a.toArray=function(b){return a.map(function(a){return[a,b[a]]},Object.keys(b))},a.apply=a.curry(function(b,c){var d=[];return a.isArray(b)&&(d=[].slice.call(b,1),b=b[0]),a.map(function(a){return a[b].apply(a,d)},c)}),a.assign=a.extend=a.curry(function(b,c){return a.each(function(a){c[a]=b[a]},Object.keys(b)),c}),a.prop=function(a){return function(b){return b[a]}},a.pluck=a.curry(function(b,c){return a.map(a.prop(b),c)}),a.exists=function(a){return null!=a},a.truthy=function(b){return a.exists(b)&&b!==!1},a.falsy=function(b){return!a.truthy(b)},a}();"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(exports=module.exports=λ),exports.λ=λ); | ||
var fjs=function(){"use strict";var a={},b="hardReturn;",c=function(a){return a.length>0?[].slice.call(a,0):[]};a.isFunction=function(a){return"function"==typeof a};var d=function(b){if(!a.isFunction(b))throw"fjs Error: Invalid function"};return a.curry=function(b){return d(b),function e(){var d=c(arguments);if(d.length===b.length)return b.apply(null,d);if(d.length>b.length){var f=b.apply(null,d);return a.fold(b,f,d.slice(b.length))}return function(){var a=c(arguments);return e.apply(null,d.concat(a))}}},a.each=a.curry(function(c,e){if(d(c),a.exists(e)&&a.isArray(e))for(var f=0;f<e.length;f+=1)if(c.call(null,e[f],f)===b)return}),a.map=a.curry(function(b,c){d(b);var e=[];return a.each(function(){e.push(b.apply(null,arguments))},c),e}),a.fold=a.foldl=a.curry(function(b,c,e){return d(b),a.each(function(a){c=b.call(null,c,a)},e),c}),a.reduce=a.reducel=a.foldll=a.curry(function(b,c){d(b);var e=c[0];return c.shift(),a.fold(b,e,c)}),a.clone=function(b){var c=[];return a.each(function(a){c.push(a)},b),c},a.first=a.curry(function(c,e){d(c);var f;return a.each(function(a){return c.call(null,a)?(f=a,b):void 0},e),f}),a.last=a.curry(function(b,c){var d=a.clone(c);return a.first(b,d.reverse())}),a.every=a.all=a.curry(function(c,e){d(c);var f=!0;return a.each(function(a){return c.call(null,a)?void 0:(f=!1,b)},e),f}),a.any=a.contains=a.curry(function(c,e){d(c);var f=!1;return a.each(function(a){return c.call(null,a)?(f=!0,b):void 0},e),f}),a.select=a.filter=a.curry(function(b,c){d(b);var e=[];return a.each(function(a){b.call(null,a)&&e.push(a)},c),e}),a.best=a.curry(function(b,c){d(b);var e=function(a,c){return b.call(this,a,c)?a:c};return a.reduce(e,c)}),a.while=a.curry(function(c,e){d(c);var f=[];return a.each(function(a){return c.call(null,a)?void f.push(a):b},e),f}),a.compose=function(b){var d=a.any(function(b){return!a.isFunction(b)});if(b=c(arguments),d(b))throw"fjs Error: Invalid function to compose";return function(){var c=arguments,d=a.each(function(a){c=[a.apply(null,c)]});return d(b.reverse()),c[0]}},a.partition=a.curry(function(b,c){d(b);var e=[],f=[];return a.each(function(a){(b.call(null,a)?e:f).push(a)},c),[e,f]}),a.group=a.curry(function(b,c){d(b);var e,f={};return a.each(function(a){e=b.call(null,a),f[e]=f[e]||[],f[e].push(a)},c),f}),a.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)},a.toArray=function(b){return a.map(function(a){return[a,b[a]]},Object.keys(b))},a.apply=a.curry(function(b,c){var d=[];return a.isArray(b)&&(d=[].slice.call(b,1),b=b[0]),a.map(function(a){return a[b].apply(a,d)},c)}),a.assign=a.extend=a.curry(function(b,c){return a.each(function(a){c[a]=b[a]},Object.keys(b)),c}),a.prop=function(a){return function(b){return b[a]}},a.pluck=a.curry(function(b,c){return a.map(a.prop(b),c)}),a.exists=function(a){return null!=a},a.truthy=function(b){return a.exists(b)&&b!==!1},a.falsy=function(b){return!a.truthy(b)},a}();"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(exports=module.exports=fjs),exports.fjs=fjs); |
@@ -7,4 +7,3 @@ module.exports = function (grunt) { | ||
"*.js", | ||
"!functional.min.js", | ||
"!functional.min.client.js" | ||
"!functional.min.js" | ||
] | ||
@@ -15,4 +14,3 @@ }, | ||
"*.js", | ||
"!functional.min.js", | ||
"!functional.min.client.js" | ||
"!functional.min.js" | ||
], | ||
@@ -41,17 +39,5 @@ tasks: ["test"] | ||
} | ||
}, | ||
"string-replace": { | ||
my_target: { | ||
files: { | ||
"functional.min.client.js": "functional.min.js" | ||
}, | ||
options: { | ||
replacements: [{ | ||
pattern: /λ/g, | ||
replacement: "lambda" | ||
}] | ||
} | ||
} | ||
} | ||
}); | ||
grunt.loadNpmTasks("grunt-contrib-watch"); | ||
@@ -61,4 +47,4 @@ grunt.loadNpmTasks("grunt-contrib-jshint"); | ||
grunt.loadNpmTasks("grunt-contrib-uglify"); | ||
grunt.loadNpmTasks("grunt-string-replace"); | ||
grunt.registerTask("test", ["jshint", "uglify", "jasmine", "string-replace"]); | ||
}; | ||
grunt.registerTask("test", ["jshint", "uglify", "jasmine"]); | ||
}; |
@@ -6,3 +6,3 @@ { | ||
"homepage": "http://functionaljs.com", | ||
"version": "0.4.12", | ||
"version": "0.5.0", | ||
"main": "functional.min.js", | ||
@@ -15,3 +15,2 @@ "keywords": [ | ||
"iterator", | ||
"collection", | ||
"lambda", | ||
@@ -18,0 +17,0 @@ "underscore" |
@@ -1,2 +0,2 @@ | ||
# functional.js (λ) [![Build Status](https://travis-ci.org/leecrossley/functional-js.png?branch=master)](https://travis-ci.org/leecrossley/functional-js) [![npm version](https://badge.fury.io/js/functional.js.png)](https://npmjs.org/package/functional.js) [![devDependency Status](https://david-dm.org/leecrossley/functional-js/dev-status.png)](https://david-dm.org/leecrossley/functional-js#info=devDependencies) | ||
# functional.js (fjs) [![Build Status](https://travis-ci.org/leecrossley/functional-js.png?branch=master)](https://travis-ci.org/leecrossley/functional-js) [![npm version](https://badge.fury.io/js/functional.js.png)](https://npmjs.org/package/functional.js) [![devDependency Status](https://david-dm.org/leecrossley/functional-js/dev-status.png)](https://david-dm.org/leecrossley/functional-js#info=devDependencies) | ||
@@ -16,3 +16,3 @@ <img align="right" src="http://functionaljs.com/css/images/logo@2x.png"> | ||
```javascript | ||
var add = λ.curry(function(arg1, arg2) { | ||
var add = fjs.curry(function(arg1, arg2) { | ||
return arg1 + arg2; | ||
@@ -19,0 +19,0 @@ }); |
358
spec.js
@@ -1,23 +0,23 @@ | ||
/*global λ*/ | ||
/*global fjs*/ | ||
describe("functional", function() { | ||
it("should have a global λ object", function() { | ||
expect(λ).toBeDefined(); | ||
it("should have a global fjs object", function() { | ||
expect(fjs).toBeDefined(); | ||
}); | ||
it("should throw an error attempting to λ.curry anything that isn't a function", function() { | ||
it("should throw an error attempting to fjs.curry anything that isn't a function", function() { | ||
var result1 = function () { | ||
λ.curry(); | ||
fjs.curry(); | ||
}; | ||
var result2 = function () { | ||
λ.curry("I am a string"); | ||
fjs.curry("I am a string"); | ||
}; | ||
expect(result1).toThrow("λ Error: Invalid function"); | ||
expect(result2).toThrow("λ Error: Invalid function"); | ||
expect(result1).toThrow("fjs Error: Invalid function"); | ||
expect(result2).toThrow("fjs Error: Invalid function"); | ||
}); | ||
it("should λ.curry a string concatenation function", function() { | ||
var concatenate = λ.curry(function(word1, word2) { | ||
it("should fjs.curry a string concatenation function", function() { | ||
var concatenate = fjs.curry(function(word1, word2) { | ||
return word1 + " " + word2; | ||
@@ -32,4 +32,4 @@ }); | ||
it("should λ.curry an addition function with multiple args and λ.curry the λ.curry", function() { | ||
var add = λ.curry(function(arg1, arg2, arg3) { | ||
it("should fjs.curry an addition function with multiple args and fjs.curry the fjs.curry", function() { | ||
var add = fjs.curry(function(arg1, arg2, arg3) { | ||
return arg1 + arg2 + arg3; | ||
@@ -47,4 +47,4 @@ }); | ||
it("should extend the arity using λ.curry", function() { | ||
var add = λ.curry(function(arg1, arg2) { | ||
it("should extend the arity using fjs.curry", function() { | ||
var add = fjs.curry(function(arg1, arg2) { | ||
return arg1 + arg2; | ||
@@ -59,3 +59,3 @@ }); | ||
it("should be able to add items to an array using λ.each", function() { | ||
it("should be able to add items to an array using fjs.each", function() { | ||
var result = [], | ||
@@ -68,3 +68,3 @@ items = ["f", "u", "n", "c"]; | ||
λ.each(addTo, items); | ||
fjs.each(addTo, items); | ||
@@ -74,3 +74,3 @@ expect(result).toEqual(items); | ||
it("should be able to λ.curry λ.each", function() { | ||
it("should be able to fjs.curry fjs.each", function() { | ||
var result = [], | ||
@@ -83,4 +83,4 @@ items = ["f", "u", "n", "c"]; | ||
var addToResult = λ.each(addTo); | ||
expect(λ.isFunction(addToResult)).toBeTruthy(); | ||
var addToResult = fjs.each(addTo); | ||
expect(fjs.isFunction(addToResult)).toBeTruthy(); | ||
@@ -91,3 +91,3 @@ addToResult(items); | ||
it("should handle null param to λ.each", function() { | ||
it("should handle null param to fjs.each", function() { | ||
var nothing = function (item) { | ||
@@ -97,3 +97,3 @@ return item; | ||
var doNothing = λ.each(nothing); | ||
var doNothing = fjs.each(nothing); | ||
@@ -107,3 +107,3 @@ var result = function () { | ||
it("should be able to double numbers in an array using λ.map", function() { | ||
it("should be able to double numbers in an array using fjs.map", function() { | ||
var items = [1, 2, 3]; | ||
@@ -115,3 +115,3 @@ | ||
var result = λ.map(doubleUp, items); | ||
var result = fjs.map(doubleUp, items); | ||
@@ -121,3 +121,3 @@ expect(result).toEqual([2, 4, 6]); | ||
it("should be able to λ.curry λ.map", function() { | ||
it("should be able to fjs.curry fjs.map", function() { | ||
var items = [1, 2, 3]; | ||
@@ -129,4 +129,4 @@ | ||
var doubleMap = λ.map(doubleUp); | ||
expect(λ.isFunction(doubleUp)).toBeTruthy(); | ||
var doubleMap = fjs.map(doubleUp); | ||
expect(fjs.isFunction(doubleUp)).toBeTruthy(); | ||
@@ -137,8 +137,8 @@ var result = doubleMap(items); | ||
it("should be able to use λ.reduce, λ.reducel or λ.foldll", function() { | ||
expect(λ.reduce).toEqual(λ.reducel); | ||
expect(λ.reduce).toEqual(λ.foldll); | ||
it("should be able to use fjs.reduce, fjs.reducel or fjs.foldll", function() { | ||
expect(fjs.reduce).toEqual(fjs.reducel); | ||
expect(fjs.reduce).toEqual(fjs.foldll); | ||
}); | ||
it("should be able to cumulate an array of numbers using λ.reduce", function() { | ||
it("should be able to cumulate an array of numbers using fjs.reduce", function() { | ||
var items = [1, 2, 3]; | ||
@@ -150,7 +150,7 @@ | ||
var result = λ.reduce(add, items); | ||
var result = fjs.reduce(add, items); | ||
expect(result).toEqual(6); | ||
}); | ||
it("should be able to cumulate an array of strings using λ.reduce", function() { | ||
it("should be able to cumulate an array of strings using fjs.reduce", function() { | ||
var items = ["f", "u", "n", "c"]; | ||
@@ -162,7 +162,7 @@ | ||
var result = λ.reduce(concatenate, items); | ||
var result = fjs.reduce(concatenate, items); | ||
expect(result).toEqual("func"); | ||
}); | ||
it("should be able to λ.curry λ.reduce", function() { | ||
it("should be able to fjs.curry fjs.reduce", function() { | ||
var items = [1, 2, 3]; | ||
@@ -174,4 +174,4 @@ | ||
var multiplyReduce = λ.reduce(multiply); | ||
expect(λ.isFunction(multiplyReduce)).toBeTruthy(); | ||
var multiplyReduce = fjs.reduce(multiply); | ||
expect(fjs.isFunction(multiplyReduce)).toBeTruthy(); | ||
@@ -182,7 +182,7 @@ var result = multiplyReduce(items); | ||
it("should be able to use λ.fold or λ.foldl", function() { | ||
expect(λ.fold).toEqual(λ.foldl); | ||
it("should be able to use fjs.fold or fjs.foldl", function() { | ||
expect(fjs.fold).toEqual(fjs.foldl); | ||
}); | ||
it("should be able to λ.curry λ.fold", function() { | ||
it("should be able to fjs.curry fjs.fold", function() { | ||
var items = [1, 2, 3]; | ||
@@ -194,4 +194,4 @@ | ||
var multiplyFoldFrom10 = λ.fold(multiply, 10); | ||
expect(λ.isFunction(multiplyFoldFrom10)).toBeTruthy(); | ||
var multiplyFoldFrom10 = fjs.fold(multiply, 10); | ||
expect(fjs.isFunction(multiplyFoldFrom10)).toBeTruthy(); | ||
@@ -202,3 +202,3 @@ var result = multiplyFoldFrom10(items); | ||
it("should be able to λ.curry λ.best", function() { | ||
it("should be able to fjs.curry fjs.best", function() { | ||
var items = [1, -4, 2, 3]; | ||
@@ -214,7 +214,7 @@ | ||
var biggestAndBest = λ.best(biggest); | ||
var bestSmallest = λ.best(smallest); | ||
var biggestAndBest = fjs.best(biggest); | ||
var bestSmallest = fjs.best(smallest); | ||
expect(λ.isFunction(biggestAndBest)).toBeTruthy(); | ||
expect(λ.isFunction(bestSmallest)).toBeTruthy(); | ||
expect(fjs.isFunction(biggestAndBest)).toBeTruthy(); | ||
expect(fjs.isFunction(bestSmallest)).toBeTruthy(); | ||
@@ -225,10 +225,10 @@ expect(biggestAndBest(items)).toEqual(3); | ||
it("should be able to λ.curry λ.best to get the longest word", function() { | ||
it("should be able to fjs.curry fjs.best to get the longest word", function() { | ||
var words = ["simply", "the", "best"]; | ||
var longest = λ.best(function (arg1, arg2) { | ||
var longest = fjs.best(function (arg1, arg2) { | ||
return arg1.length > arg2.length; | ||
}); | ||
expect(λ.isFunction(longest)).toBeTruthy(); | ||
expect(fjs.isFunction(longest)).toBeTruthy(); | ||
@@ -238,3 +238,3 @@ expect(longest(words)).toEqual("simply"); | ||
it("should be able to λ.curry λ.while to get even numbers until odd", function() { | ||
it("should be able to fjs.curry fjs.while to get even numbers until odd", function() { | ||
var even = function (item) { | ||
@@ -244,3 +244,3 @@ return item % 2 === 0; | ||
var whileEven = λ.while(even); | ||
var whileEven = fjs.while(even); | ||
@@ -252,7 +252,7 @@ expect(whileEven([2])).toEqual([2]); | ||
it("should be able to use λ.any or λ.contains", function() { | ||
expect(λ.any).toEqual(λ.contains); | ||
it("should be able to use fjs.any or fjs.contains", function() { | ||
expect(fjs.any).toEqual(fjs.contains); | ||
}); | ||
it("should be able to λ.curry λ.any", function() { | ||
it("should be able to fjs.curry fjs.any", function() { | ||
var items1 = [1, 2, 3], | ||
@@ -265,4 +265,4 @@ items2 = [1, 3, 5]; | ||
var anyEven = λ.any(even); | ||
var containsEven = λ.contains(even); | ||
var anyEven = fjs.any(even); | ||
var containsEven = fjs.contains(even); | ||
@@ -275,3 +275,3 @@ expect(anyEven(items1)).toBeTruthy(); | ||
it("should be able to λ.curry λ.select", function() { | ||
it("should be able to fjs.curry fjs.select", function() { | ||
var items = [1, 2, 3, 4, 5]; | ||
@@ -286,4 +286,4 @@ | ||
var selectEven = λ.select(even); | ||
var selectOdd = λ.select(odd); | ||
var selectEven = fjs.select(even); | ||
var selectOdd = fjs.select(odd); | ||
@@ -294,6 +294,6 @@ expect(selectEven(items)).toEqual([2, 4]); | ||
it("should be able to λ.clone an array and keep independence", function() { | ||
it("should be able to fjs.clone an array and keep independence", function() { | ||
var items = [5, 4, 3, 2, 1]; | ||
var clonedItems = λ.clone(items); | ||
var clonedItems = fjs.clone(items); | ||
@@ -305,3 +305,3 @@ expect(clonedItems).toEqual(items); | ||
it("should be able to λ.curry λ.first", function() { | ||
it("should be able to fjs.curry fjs.first", function() { | ||
var items = [5, 4, 3, 2, 1]; | ||
@@ -316,4 +316,4 @@ | ||
var firstEven = λ.first(even); | ||
var firstOdd = λ.first(odd); | ||
var firstEven = fjs.first(even); | ||
var firstOdd = fjs.first(odd); | ||
@@ -324,3 +324,3 @@ expect(firstEven(items)).toEqual(4); | ||
it("should be able to λ.curry λ.last", function() { | ||
it("should be able to fjs.curry fjs.last", function() { | ||
var items = [5, 4, 3, 2, 1]; | ||
@@ -335,4 +335,4 @@ | ||
var lastEven = λ.last(even); | ||
var lastOdd = λ.last(odd); | ||
var lastEven = fjs.last(even); | ||
var lastOdd = fjs.last(odd); | ||
@@ -343,3 +343,3 @@ expect(lastEven(items)).toEqual(2); | ||
it("should be able to λ.curry λ.every", function() { | ||
it("should be able to fjs.curry fjs.every", function() { | ||
var items = [2, 4, 6, 8]; | ||
@@ -354,4 +354,4 @@ | ||
var everyEven = λ.every(even); | ||
var everyOdd = λ.every(odd); | ||
var everyEven = fjs.every(even); | ||
var everyOdd = fjs.every(odd); | ||
@@ -362,7 +362,7 @@ expect(everyEven(items)).toEqual(true); | ||
it("should be able to use λ.every or λ.all", function() { | ||
expect(λ.every).toEqual(λ.all); | ||
it("should be able to use fjs.every or fjs.all", function() { | ||
expect(fjs.every).toEqual(fjs.all); | ||
}); | ||
it("should throw an error attempting to λ.compose anything that isn't a function", function() { | ||
it("should throw an error attempting to fjs.compose anything that isn't a function", function() { | ||
var f = function (a) { | ||
@@ -374,9 +374,9 @@ return "hello " + a; | ||
var result = function () { | ||
λ.compose(f, g); | ||
fjs.compose(f, g); | ||
}; | ||
expect(result).toThrow("λ Error: Invalid function to compose"); | ||
expect(result).toThrow("fjs Error: Invalid function to compose"); | ||
}); | ||
it("should be able to λ.compose two functions", function() { | ||
it("should be able to fjs.compose two functions", function() { | ||
var f = function (a) { | ||
@@ -388,3 +388,3 @@ return "hello " + a; | ||
}; | ||
var composed = λ.compose(f, g); | ||
var composed = fjs.compose(f, g); | ||
@@ -394,3 +394,3 @@ expect(composed(1)).toEqual("hello 2"); | ||
it("should be able to λ.compose multiple functions", function() { | ||
it("should be able to fjs.compose multiple functions", function() { | ||
var e = function (a) { | ||
@@ -405,3 +405,3 @@ return "hello " + a; | ||
}; | ||
var composed = λ.compose(e, f, g); | ||
var composed = fjs.compose(e, f, g); | ||
@@ -411,3 +411,3 @@ expect(composed(2)).toEqual("hello 201"); | ||
it("should be able to λ.partition an array of odd and even numbers", function() { | ||
it("should be able to fjs.partition an array of odd and even numbers", function() { | ||
var items = [1, 2, 3, 4, 5, 6, 7]; | ||
@@ -419,3 +419,3 @@ | ||
var result = λ.partition(even, items); | ||
var result = fjs.partition(even, items); | ||
@@ -425,3 +425,3 @@ expect(result).toEqual([[2, 4, 6], [1, 3, 5, 7]]); | ||
it("should be able to λ.curry λ.partition", function() { | ||
it("should be able to fjs.curry fjs.partition", function() { | ||
var items = [7, 6, 5, 4, 3, 2, 1]; | ||
@@ -433,3 +433,3 @@ | ||
var partitionEven = λ.partition(even); | ||
var partitionEven = fjs.partition(even); | ||
@@ -441,3 +441,3 @@ var result = partitionEven(items); | ||
it("should be able to λ.curry λ.group", function() { | ||
it("should be able to fjs.curry fjs.group", function() { | ||
var items = ["Lee", "Ryan", "Leona", "Sarah", "Rob", "Liam"]; | ||
@@ -449,3 +449,3 @@ | ||
var groupFirstLetter = λ.group(firstLetter); | ||
var groupFirstLetter = fjs.group(firstLetter); | ||
@@ -458,3 +458,3 @@ var result = groupFirstLetter(items); | ||
it("should be able to λ.curry λ.pluck", function() { | ||
it("should be able to fjs.curry fjs.pluck", function() { | ||
var items = [{ | ||
@@ -474,5 +474,5 @@ "p1": "abc", | ||
var pluck1 = λ.pluck("p1"); | ||
var pluck1 = fjs.pluck("p1"); | ||
var result1 = pluck1(items); | ||
var pluck2 = λ.pluck("p2"); | ||
var pluck2 = fjs.pluck("p2"); | ||
var result2 = pluck2(items); | ||
@@ -491,13 +491,13 @@ | ||
var result = λ.toArray(obj); | ||
var result = fjs.toArray(obj); | ||
expect(result).toEqual([["p1", "abc"], ["p2", false], ["p3", null]]); | ||
expect(λ.isArray(obj)).toBeFalsy(); | ||
expect(λ.isArray(result)).toBeTruthy(); | ||
expect(fjs.isArray(obj)).toBeFalsy(); | ||
expect(fjs.isArray(result)).toBeTruthy(); | ||
}); | ||
it("should be able to λ.curry λ.apply", function() { | ||
it("should be able to fjs.curry fjs.apply", function() { | ||
var items = ["Hello", "World"]; | ||
var applyCase = λ.apply("toUpperCase"); | ||
var applyCase = fjs.apply("toUpperCase"); | ||
@@ -509,6 +509,6 @@ var result = applyCase(items); | ||
it("should be able to λ.curry λ.apply with additional argument", function() { | ||
it("should be able to fjs.curry fjs.apply with additional argument", function() { | ||
var items = ["Hello", "World"]; | ||
var applyIndexOf = λ.apply(["indexOf", "o"]); | ||
var applyIndexOf = fjs.apply(["indexOf", "o"]); | ||
@@ -520,6 +520,6 @@ var result = applyIndexOf(items); | ||
it("should be able to λ.curry λ.apply with multiple arguments", function() { | ||
it("should be able to fjs.curry fjs.apply with multiple arguments", function() { | ||
var items = ["Hello", "World"]; | ||
var applyIndexOf = λ.apply(["substring", "1", "4"]); | ||
var applyIndexOf = fjs.apply(["substring", "1", "4"]); | ||
@@ -531,7 +531,7 @@ var result = applyIndexOf(items); | ||
it("should be able to use λ.assign or λ.extend", function() { | ||
expect(λ.assign).toEqual(λ.extend); | ||
it("should be able to use fjs.assign or fjs.extend", function() { | ||
expect(fjs.assign).toEqual(fjs.extend); | ||
}); | ||
it("should be able to do a basic λ.assign", function() { | ||
it("should be able to do a basic fjs.assign", function() { | ||
var obj1 = { | ||
@@ -546,3 +546,3 @@ prop1: "obj1prop1", | ||
var result = λ.assign(obj1, obj2); | ||
var result = fjs.assign(obj1, obj2); | ||
@@ -556,3 +556,3 @@ expect(result).toEqual({ | ||
it("should be able to λ.curry λ.assign and extend the arity", function() { | ||
it("should be able to fjs.curry fjs.assign and extend the arity", function() { | ||
var obj1 = { | ||
@@ -572,6 +572,6 @@ prop1: "obj1prop1", | ||
var assignToObj1 = λ.assign(obj1); | ||
var assignToObj1 = fjs.assign(obj1); | ||
var result1 = assignToObj1(obj2, obj3); | ||
var result2 = λ.assign(obj1, obj2, obj3); | ||
var result2 = fjs.assign(obj1, obj2, obj3); | ||
@@ -588,86 +588,86 @@ expect(result1).toEqual({ | ||
it("should have correct return values for λ.exists", function() { | ||
expect(λ.exists(undefined)).toBeFalsy(); | ||
expect(λ.exists(null)).toBeFalsy(); | ||
it("should have correct return values for fjs.exists", function() { | ||
expect(fjs.exists(undefined)).toBeFalsy(); | ||
expect(fjs.exists(null)).toBeFalsy(); | ||
expect(λ.exists(1)).toBeTruthy(); | ||
expect(λ.exists(-1)).toBeTruthy(); | ||
expect(λ.exists(0)).toBeTruthy(); | ||
expect(λ.exists("abc")).toBeTruthy(); | ||
expect(λ.exists("")).toBeTruthy(); | ||
expect(λ.exists(Number.MAX_VALUE)).toBeTruthy(); | ||
expect(λ.exists(Number.MIN_VALUE)).toBeTruthy(); | ||
expect(λ.exists(NaN)).toBeTruthy(); | ||
expect(λ.exists(0144)).toBeTruthy(); | ||
expect(λ.exists(0xFF)).toBeTruthy(); | ||
expect(λ.exists(0.1)).toBeTruthy(); | ||
expect(λ.exists(-0.1)).toBeTruthy(); | ||
expect(λ.exists(3e5)).toBeTruthy(); | ||
expect(λ.exists(true)).toBeTruthy(); | ||
expect(λ.exists(false)).toBeTruthy(); | ||
expect(λ.exists(Infinity)).toBeTruthy(); | ||
expect(λ.exists(Number.POSITIVE_INFINITY)).toBeTruthy(); | ||
expect(λ.exists(Number.NEGATIVE_INFINITY)).toBeTruthy(); | ||
expect(λ.exists(new Date())).toBeTruthy(); | ||
expect(λ.exists([])).toBeTruthy(); | ||
expect(λ.exists({})).toBeTruthy(); | ||
expect(λ.exists(function() { })).toBeTruthy(); | ||
expect(fjs.exists(1)).toBeTruthy(); | ||
expect(fjs.exists(-1)).toBeTruthy(); | ||
expect(fjs.exists(0)).toBeTruthy(); | ||
expect(fjs.exists("abc")).toBeTruthy(); | ||
expect(fjs.exists("")).toBeTruthy(); | ||
expect(fjs.exists(Number.MAX_VALUE)).toBeTruthy(); | ||
expect(fjs.exists(Number.MIN_VALUE)).toBeTruthy(); | ||
expect(fjs.exists(NaN)).toBeTruthy(); | ||
expect(fjs.exists(0144)).toBeTruthy(); | ||
expect(fjs.exists(0xFF)).toBeTruthy(); | ||
expect(fjs.exists(0.1)).toBeTruthy(); | ||
expect(fjs.exists(-0.1)).toBeTruthy(); | ||
expect(fjs.exists(3e5)).toBeTruthy(); | ||
expect(fjs.exists(true)).toBeTruthy(); | ||
expect(fjs.exists(false)).toBeTruthy(); | ||
expect(fjs.exists(Infinity)).toBeTruthy(); | ||
expect(fjs.exists(Number.POSITIVE_INFINITY)).toBeTruthy(); | ||
expect(fjs.exists(Number.NEGATIVE_INFINITY)).toBeTruthy(); | ||
expect(fjs.exists(new Date())).toBeTruthy(); | ||
expect(fjs.exists([])).toBeTruthy(); | ||
expect(fjs.exists({})).toBeTruthy(); | ||
expect(fjs.exists(function() { })).toBeTruthy(); | ||
}); | ||
it("should have correct return values for λ.truthy", function() { | ||
expect(λ.truthy(undefined)).toBeFalsy(); | ||
expect(λ.truthy(null)).toBeFalsy(); | ||
expect(λ.truthy(false)).toBeFalsy(); | ||
it("should have correct return values for fjs.truthy", function() { | ||
expect(fjs.truthy(undefined)).toBeFalsy(); | ||
expect(fjs.truthy(null)).toBeFalsy(); | ||
expect(fjs.truthy(false)).toBeFalsy(); | ||
expect(λ.truthy(1)).toBeTruthy(); | ||
expect(λ.truthy(-1)).toBeTruthy(); | ||
expect(λ.truthy(0)).toBeTruthy(); | ||
expect(λ.truthy("abc")).toBeTruthy(); | ||
expect(λ.truthy("")).toBeTruthy(); | ||
expect(λ.truthy(Number.MAX_VALUE)).toBeTruthy(); | ||
expect(λ.truthy(Number.MIN_VALUE)).toBeTruthy(); | ||
expect(λ.truthy(NaN)).toBeTruthy(); | ||
expect(λ.truthy(0144)).toBeTruthy(); | ||
expect(λ.truthy(0xFF)).toBeTruthy(); | ||
expect(λ.truthy(0.1)).toBeTruthy(); | ||
expect(λ.truthy(-0.1)).toBeTruthy(); | ||
expect(λ.truthy(3e5)).toBeTruthy(); | ||
expect(λ.truthy(true)).toBeTruthy(); | ||
expect(λ.truthy(Infinity)).toBeTruthy(); | ||
expect(λ.truthy(Number.POSITIVE_INFINITY)).toBeTruthy(); | ||
expect(λ.truthy(Number.NEGATIVE_INFINITY)).toBeTruthy(); | ||
expect(λ.truthy(new Date())).toBeTruthy(); | ||
expect(λ.truthy([])).toBeTruthy(); | ||
expect(λ.truthy({})).toBeTruthy(); | ||
expect(λ.truthy(function() { })).toBeTruthy(); | ||
expect(fjs.truthy(1)).toBeTruthy(); | ||
expect(fjs.truthy(-1)).toBeTruthy(); | ||
expect(fjs.truthy(0)).toBeTruthy(); | ||
expect(fjs.truthy("abc")).toBeTruthy(); | ||
expect(fjs.truthy("")).toBeTruthy(); | ||
expect(fjs.truthy(Number.MAX_VALUE)).toBeTruthy(); | ||
expect(fjs.truthy(Number.MIN_VALUE)).toBeTruthy(); | ||
expect(fjs.truthy(NaN)).toBeTruthy(); | ||
expect(fjs.truthy(0144)).toBeTruthy(); | ||
expect(fjs.truthy(0xFF)).toBeTruthy(); | ||
expect(fjs.truthy(0.1)).toBeTruthy(); | ||
expect(fjs.truthy(-0.1)).toBeTruthy(); | ||
expect(fjs.truthy(3e5)).toBeTruthy(); | ||
expect(fjs.truthy(true)).toBeTruthy(); | ||
expect(fjs.truthy(Infinity)).toBeTruthy(); | ||
expect(fjs.truthy(Number.POSITIVE_INFINITY)).toBeTruthy(); | ||
expect(fjs.truthy(Number.NEGATIVE_INFINITY)).toBeTruthy(); | ||
expect(fjs.truthy(new Date())).toBeTruthy(); | ||
expect(fjs.truthy([])).toBeTruthy(); | ||
expect(fjs.truthy({})).toBeTruthy(); | ||
expect(fjs.truthy(function() { })).toBeTruthy(); | ||
}); | ||
it("should have correct return values for λ.falsy", function() { | ||
expect(λ.falsy(undefined)).toBeTruthy(); | ||
expect(λ.falsy(null)).toBeTruthy(); | ||
expect(λ.falsy(false)).toBeTruthy(); | ||
it("should have correct return values for fjs.falsy", function() { | ||
expect(fjs.falsy(undefined)).toBeTruthy(); | ||
expect(fjs.falsy(null)).toBeTruthy(); | ||
expect(fjs.falsy(false)).toBeTruthy(); | ||
expect(λ.falsy(1)).toBeFalsy(); | ||
expect(λ.falsy(-1)).toBeFalsy(); | ||
expect(λ.falsy(0)).toBeFalsy(); | ||
expect(λ.falsy("abc")).toBeFalsy(); | ||
expect(λ.falsy("")).toBeFalsy(); | ||
expect(λ.falsy(Number.MAX_VALUE)).toBeFalsy(); | ||
expect(λ.falsy(Number.MIN_VALUE)).toBeFalsy(); | ||
expect(λ.falsy(NaN)).toBeFalsy(); | ||
expect(λ.falsy(0144)).toBeFalsy(); | ||
expect(λ.falsy(0xFF)).toBeFalsy(); | ||
expect(λ.falsy(0.1)).toBeFalsy(); | ||
expect(λ.falsy(-0.1)).toBeFalsy(); | ||
expect(λ.falsy(3e5)).toBeFalsy(); | ||
expect(λ.falsy(true)).toBeFalsy(); | ||
expect(λ.falsy(Infinity)).toBeFalsy(); | ||
expect(λ.falsy(Number.POSITIVE_INFINITY)).toBeFalsy(); | ||
expect(λ.falsy(Number.NEGATIVE_INFINITY)).toBeFalsy(); | ||
expect(λ.falsy(new Date())).toBeFalsy(); | ||
expect(λ.falsy([])).toBeFalsy(); | ||
expect(λ.falsy({})).toBeFalsy(); | ||
expect(λ.falsy(function() { })).toBeFalsy(); | ||
expect(fjs.falsy(1)).toBeFalsy(); | ||
expect(fjs.falsy(-1)).toBeFalsy(); | ||
expect(fjs.falsy(0)).toBeFalsy(); | ||
expect(fjs.falsy("abc")).toBeFalsy(); | ||
expect(fjs.falsy("")).toBeFalsy(); | ||
expect(fjs.falsy(Number.MAX_VALUE)).toBeFalsy(); | ||
expect(fjs.falsy(Number.MIN_VALUE)).toBeFalsy(); | ||
expect(fjs.falsy(NaN)).toBeFalsy(); | ||
expect(fjs.falsy(0144)).toBeFalsy(); | ||
expect(fjs.falsy(0xFF)).toBeFalsy(); | ||
expect(fjs.falsy(0.1)).toBeFalsy(); | ||
expect(fjs.falsy(-0.1)).toBeFalsy(); | ||
expect(fjs.falsy(3e5)).toBeFalsy(); | ||
expect(fjs.falsy(true)).toBeFalsy(); | ||
expect(fjs.falsy(Infinity)).toBeFalsy(); | ||
expect(fjs.falsy(Number.POSITIVE_INFINITY)).toBeFalsy(); | ||
expect(fjs.falsy(Number.NEGATIVE_INFINITY)).toBeFalsy(); | ||
expect(fjs.falsy(new Date())).toBeFalsy(); | ||
expect(fjs.falsy([])).toBeFalsy(); | ||
expect(fjs.falsy({})).toBeFalsy(); | ||
expect(fjs.falsy(function() { })).toBeFalsy(); | ||
}); | ||
}); |
39557
11
796