Sha256: 567b57be6212633b0218d77fe5d28598aa889245deb4dbe8260f016d3fdde9d5
Contents?: true
Size: 1.16 KB
Versions: 6
Compression:
Stored size: 1.16 KB
Contents
values = (object) -> [x for , x of object] keys = (object) -> [x for x of object] pairs-to-obj= (object) -> {[x.0, x.1] for x in object} obj-to-pairs = (object) -> [[key, value] for key, value of object] lists-to-obj= (keys, values) --> {[key, values[i]] for key, i in keys} obj-to-lists = (objectect) -> keys = [] values = [] for key, value of objectect keys.push key values.push value [keys, values] empty = (object) -> for x of object then return false true each = (f, object) --> for , x of object then f x object map = (f, object) --> {[k, f x] for k, x of object} compact = (object) --> {[k, x] for k, x of object when x} filter = (f, object) --> {[k, x] for k, x of object when f x} reject = (f, object) --> {[k, x] for k, x of object when not f x} partition = (f, object) --> passed = {} failed = {} for k, x of object (if f x then passed else failed)[k] = x [passed, failed] find = (f, object) --> for , x of object when f x then return x void module.exports = { values, keys, pairs-to-obj, obj-to-pairs, lists-to-obj, obj-to-lists, empty, each, map, filter, compact, reject, partition, find, }
Version data entries
6 entries across 6 versions & 2 rubygems