Giter Club home page Giter Club logo

jagged-array's Introduction

jagged-array

A set of functions to work with jagged arrays (arrays of arrays) in Javascript with any number of dimensions

Installation

Run npm install jagged-array

API

countDimensions

Counts the number of dimensions the array contains.

  • Argument array: any|any[] Array to check
  • Returns number An optional implementation of multimatch to inject into this class, if null or not defined will use the default multimatch.

hasJaggedEdges

Checks if the given array has jagged edges, that is if any of the dimension has variation in its length.

  • Argument array: any|any[] Array to check
  • Returns boolean True if jagged edges are found. Returns false for non-arrays.

getMaxLengths

Get largest edge for each dimension.

  • Argument array: any|any[] Array to check
  • Returns number[] An array of lengths for each dimension. It takes the biggest length of any array in the given dimension

containsValue

Checks if the given array (or array of arrays) contains specific value. Warning: it won't be able to detect NaN!

  • Argument haystack: any[]|any Array which is searched through
  • Argument needle: any Value to find
  • Argument useStrictComparison: boolean = true Whether to use strict comparison or not
  • Returns boolean Whether the value was found or not

countValue

Counts how many times given value appears in the array (or array of arrays). Warning: it won't detect NaN!

  • Argument haystack: any[]|any Array which is searched through
  • Argument needle: any Value to count
  • Argument useStrictComparison: boolean = true Whether to use strict comparison or not
  • Returns boolean Number of times the value was found

getUniqueValues

Returns an array of all the unique values in the given array (or array of arrays). Each instance of NaN is considered unique.

  • Argument array: any | any[] Array which is searched through
  • Returns boolean Values found, each value appears only once in the resulting array with the exception of NaN.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.