1.4.1 • Published 7 years ago

iop v1.4.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Miscellaneous useful functions in one place.

Arrays

count(a, f)

Count how many elements of an array satisfy a predicate.

Functional maps

val = get(m, key)

Get a value. If not present, returns the false value supplied initially for this map. This operation takes O(N) time.

m = put(m, key, val)

Put a new key-value pair in a map, returning the new map while leaving the old one unchanged. Any existing value for that key will be overridden. Represent an empty map with any false value. Keys don't need to be ordered, just comparable by strict equality. This operation takes O(1) time.

These functions also work with JavaScript Maps. In that case, put still works in functional style, creating a new Map, which takes O(N) time but lets subsequent gets take O(1) time.

ctype

isalnum(c)
isalpha(c)
isdigit(c)
islower(c)
isspace(c)
isupper(c)

As the C equivalents.

print

print(a)

Print a value with useful settings, including full expansion of nested objects to any depth, arrays to any length, and color coding that turns off when stdout is redirected.

1.4.1

7 years ago

1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago