prelude-extension
Advanced tools
Comparing version 0.0.13 to 0.1.0
27
index.js
@@ -0,4 +1,18 @@ | ||
// Generated by LiveScript 1.4.0 | ||
(function(){ | ||
var ref$, all, any, concatMap, each, filter, find, isType, keys, map, Obj, objToPairs, partition, reverse, sortBy, clamp, findAll, get, isEmptyObject, isEqualToObject, partitionString, mappend, rextend, set, transpose, unwrap, slice$ = [].slice, toString$ = {}.toString; | ||
ref$ = require('prelude-ls'), all = ref$.all, any = ref$.any, concatMap = ref$.concatMap, each = ref$.each, filter = ref$.filter, find = ref$.find, isType = ref$.isType, keys = ref$.keys, map = ref$.map, Obj = ref$.Obj, objToPairs = ref$.objToPairs, partition = ref$.partition, reverse = ref$.reverse, sortBy = ref$.sortBy; | ||
var ref$, all, any, concatMap, each, filter, find, fold, isType, keys, map, Obj, objToPairs, partition, reverse, sortBy, batch, clamp, findAll, get, isEmptyObject, isEqualToObject, partitionString, mappend, rextend, set, transpose, unwrap, slice$ = [].slice, toString$ = {}.toString; | ||
ref$ = require('prelude-ls'), all = ref$.all, any = ref$.any, concatMap = ref$.concatMap, each = ref$.each, filter = ref$.filter, find = ref$.find, fold = ref$.fold, isType = ref$.isType, keys = ref$.keys, map = ref$.map, Obj = ref$.Obj, objToPairs = ref$.objToPairs, partition = ref$.partition, reverse = ref$.reverse, sortBy = ref$.sortBy; | ||
batch = curry$(function(size, items){ | ||
return fold(function(acc, item){ | ||
var lastBatch; | ||
lastBatch = acc[acc.length - 1]; | ||
if (lastBatch.length < size) { | ||
lastBatch.push(item); | ||
return acc; | ||
} else { | ||
return [].concat(acc, [[item]]); | ||
} | ||
}, [[]])( | ||
items); | ||
}); | ||
clamp = curry$(function(n, min, max){ | ||
@@ -29,5 +43,4 @@ return Math.max(min, Math.min(max, n)); | ||
}); | ||
isEmptyObject = function(o){ | ||
var numberOfKeys; | ||
numberOfKeys = function(it){ | ||
isEmptyObject = function(object){ | ||
return 0 === function(it){ | ||
return it.length; | ||
@@ -39,4 +52,3 @@ }( | ||
})( | ||
o))); | ||
return numberOfKeys === 0; | ||
object))); | ||
}; | ||
@@ -179,2 +191,3 @@ isEqualToObject = curry$(function(o1, o2){ | ||
module.exports = { | ||
batch: batch, | ||
clamp: clamp, | ||
@@ -181,0 +194,0 @@ findAll: findAll, |
{ | ||
"name": "prelude-extension", | ||
"version": "0.0.13", | ||
"version": "0.1.0", | ||
"description": "prelude-extension", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,2 +11,4 @@ Prelude Extension | ||
# Functions | ||
`batch :: Number -> [a] -> [[a]]` | ||
`clamp :: Number -> Number -> Number` | ||
@@ -13,0 +15,0 @@ |
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
19293
458
38