Skip to content

Releases: EvandroLG/array.lua

Array.lua v1.3.6

18 Jan 18:17
Compare
Choose a tag to compare

What's new?

  • Added two new methods:
    • array.key_by(obj:table, callback:function):table

      Creates a new table composed of keys generated from the results of running each element of the given table through the given callback.

    • array.flat_map(obj:table, callback: function):table

      Returns a new array-like table by applying a given callback to each element of the table, and then flattening the result by one level.

Full Changelog: v1.3.5...v1.3.6

Array.lua v1.3.5

25 Dec 20:55
Compare
Choose a tag to compare

What's new?

  • Updates the array.flat function, adding a depth parameter that specify how deep a nested array structure should be flattened.

Full Changelog: v1.3.4...v1.3.5

Array.lua v1.3.4

10 Dec 16:08
Compare
Choose a tag to compare

What's new?

  • Fixed bug on array.slice method to work with negative values
  • Added a new methods:
    • array.permutation(object:table):table
      Returns a new array-like table with elements splitted into groups of length of size

Array.lua v1.3.3

14 Oct 19:23
Compare
Choose a tag to compare

What's new?

  • array.concat method was rewritten. Now it's accepting multiple tables as parameter.

  • Fixed bugs in array.slice method.

  • Added two new methods:

    • array.permutation(object:table):table
      Creates a new table returning all permutations of length of the elements of the given table

    • array.random(object:table):*
      Returns a value from a random key of the given array

    • array.group_by(object:table, callback:function):table
      Returns a new table composed by keys created from the results of running each element through callback

Array.lua v1.3.2

08 Jun 18:21
Compare
Choose a tag to compare

What's new?

  • array.flat method was refactored

  • Added two new methods:

    • array.each(object:table, callback:function):void

      Executes callback once for each table element

    • array.reverse_each(object:table, callback:function):void

      Executes callback once for each table element in reverse order

  • Created a Doc page (https://evandrolg.github.io/array.lua/)

Array.lua v1.3.0

18 Dec 12:13
Compare
Choose a tag to compare

What's new from Array.lua v1.2.6?

  • Improved performance of diff method. It was working in quadratic time and now we're using a linear solution.

  • Added five new methods:

    • array.fill(value:*, [start:number], end:number):table

      Creates a table filling all the elements from a start index (default
      one) to an end index with a default value passed by parameter.

    • array.remove(object:table, callback:function):table

      Removes all elements from table that callback returns truthy for and returns a new table with the removed elements

    • array.counter(object:table):table

      Returns a new table in hash structure, where keys represent each array value

    • array.intersect(object:table, object:table):table

      Returns a new table with the values that exist in both tables

    • array.from_pairs(object:table, object:table):table

      Returns a table composed from key-value pairs

Array.lua v1.2.6

13 Sep 15:50
Compare
Choose a tag to compare

What's new from Array.lua v1.2.5?

Added three more methods in the core of array.lua:

  • array.reduce_right(object:table):table
    Works like reduce except that it iterates over table's elements from right to left

  • array.sum(object:table):number
    Returns the sum of the values of the table passed by parameter

  • array. remove(object:table, callback:function):table
    Removes all elements from table that callback returns truthy for and returns a new table with the removed elements

Array.lua v1.2.5

30 Jun 20:05
Compare
Choose a tag to compare

A small library with useful methods to handle Lua's table when it's working like an Array.

What's new from Array.lua v1.2.4?

Added two more methods in the core of array.lua:

  • array.flat(object:table):table
    Creates a new table with the sub-table elements concatenated into it

  • array.fill(value:*, [start:number], end:number):table
    Creates a table filling all the elements from a start index (default one) to an end index with a default value passed by parameter.

Array.lua v1.2.3

26 Nov 19:55
Compare
Choose a tag to compare

A small library with useful methods to handle Lua's table when it's working like an Array.

What's new from Array.lua v1.2.2?

  • Added array.diff function. It returns a new table with the items which exist only in the first table
  • Updated array.concat function. Now it's returning a new table instead of changes the previous object passed by parameter
  • Update the name of the following methods array.deep_copy and array.shallow_copy. Before they were in camel case.