Fork me on GitHub

Hash.copy(object:table):table

Makes a shallow copy of the table passed by parameter.

Hash.deep_copy(object:table):table

Makes a deep copy of the table passed by parameter.

Hash.each(object:table):nil

Iterates over a table, yielding each in turn to an iteratee function.

Hash.find(object:table,callback:table|function):any

Returns the value of the first item that satisfies the provided testing function.

Hash.invert(object:table):table

Creates a new table composed of the inverted keys and values of the table passed by parameter

Hash.is_circular(object:table):boolean

Checks if table has circular references

Hash.is_empty(object:table):boolean

Checks if table is empty.

Hash.is_hash(object:table):boolean

Verifies if table works like an object.

Hash.keys(object:table):table

Returns a new table populated with the all keys from the table passed as parameter.

Hash.map(object:table,callback:function):table

Returns a new table of values by mapping each value in table through a transformation function.

Hash.merge(object1:table,object2:table):table

Returns a new table containing the contents of `object1` and `object2`.

Hash.omit(object:table,keys:table|function):table

Returns a copy of the object passed by parameter omitting the keys decided in the second parameter.

Hash.pick(object:table,keys:table|function):table

Returns a new table filtered only with values for the keys passed by parameter. Alternatively it accepts a callback where you can filter which keys to pick.

Hash.remove_key(object:table,key:string):boolean

Removes the key from the table; returns true if it was found and removed, otherwise it returns false.

Hash.size(object:table):number

Iterates over a table, yielding each in turn to an iteratee function.

Hash.values(object:table):table

Returns a new table populated with the all values from the table passed as paramter.