npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sanjo-addons/array

v2.1.1

Published

This work is devoted to God.

Downloads

12

Readme

Lua Array

This work is devoted to God.

A library of functions for arrays which can be used by other add-ons to save some development work.

Most functions are similar to the functions for arrays which are provided by JavaScript.

Please check out the source code for details regarding the function parameters.

The functions include:

  • Array.length: a function for determining the length of an array in a way that supports "gaps" in arrays.
  • Array.filter: a function for filtering an array.
  • Array.findIndex: a function for finding an index of an array element whose value meets certain conditions.
  • Array.indexOf: a function for finding the index of a value in an array.
  • Array.find: a function for finding an element in an array which meets certain conditions.
  • Array.includes: a function for checking if an array includes a specific value.
  • Array.map: a function for mapping all values of an array to other values.
  • Array.reduce: a function to aggregate the values of an array to one value.
  • Array.all: a function to check if all elements in an array meet certain conditions.
  • Array.copy: a function to copy an array.
  • Array.concat: a function to concat multiple arrays.
  • Array.append: a function to append the elements of an array to another array.
  • Array.extreme: a function to find the most "extreme" value in an array based on an "extreme" function which tells the function if a value is more "extreme" than another.
  • Array.min: a function which returns the minimum value.
  • Array.max: a function which returns the maximum value.
  • Array.maxCompare: a function which returns the maximum value and supports a custom compare function.
  • Array.count: a function which counts the number of elements which meet certain conditions.
  • Array.any: a function which returns true when any of the elements of an array meet certain conditions.
  • Array.groupBy: a function to group the elements of an array.
  • Array.pickWhile: a function to pick elements as long as the current element meets certain conditions.
  • Array.slice: a function that can create a new array which is a "slice" of another array.
  • Array.unique: a function which removes duplicates in an array. Therefore creates an array where the elements are unique in the array (occur only once).
  • Array.forEach: a function for doing something for each element in an array.
  • Array.equals: a function for checking if two array are equal.
  • Array.flat: a function for flattening an array one level.
  • Array.flatMap: a functions for first mapping the elements of an array and then flattening the resulting array.
  • Array.isArray: a function for checking if a table is an array.
  • Array.isArrayWithSubsequentIndexes: a function for checking if a list is an array with subsequent indexes.
  • Array.selectTrue: a function which returns a new array which only includes elements of the passed array which evaluated as "truthy".
  • Array.generateNumbers: a function for generating an array with subsequent numbers.
  • Array.isTrueForAllInInterval: a function which checks if a predicate is true for a set of numbers (specified via from, to and interval).
  • Array.hasElements: an array which checks if an array has any elements (one or more).
  • Array.isEmpty: a function which checks if an array is empty (has zero elements).
  • Array.remove: a function for removing all elements of an array which equal a given value.
  • Array.removeFirstOccurence: a function for removing the first element of an array which equals a given value.
  • Array.create: a function for creating an array. This array has all the array functions on its metatable.

How to use

Please see "How to use Library" for how to use this library.