npm.io
1.0.0 • Published 10 years ago

js-kata-modules

Licence
ISC
Version
1.0.0
Deps
7
Vulns
0
Weekly
0

hikurangi-lisa-utils

map(func, arr):

var timesTwo = function (num) { return num * 2 } var someNumbers = [2, 4, 6] var actualNumbers = map(timesTwo, someNumbers) // actualNumbers = [4, 8, 12]

filter(func, arr): data = ["a string", "oh look, another string"] function filterStringsWithCommas (str) { return (str.indexOf(',') > -1); } var stringsWithCommas = filter(filterStringsWithCommas, data) // stringsWithCommas = ["oh look, another string"]

countIf(func, arr): var nums [1, 2, 3, 4, 5, 6] var count = countIf(isLessThan3, arr) // count = [1, 2]