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

jsarraymethods

v1.0.3

Published

Array methods developed for ease of use for developers

Downloads

7

Readme

What is this?

This package describes some of the array method

Installation:

npm i jsarraymethods

Importing:

const jsarraymethods=require('jsarraymethods');

Available Functions:

SORT:

Sorts the given array in ascending order.

let arr = [15, 25, 58, 7, 2, 63];
let result = jsarraymethods.sort(arr); //output should be [2, 7, 15, 25, 58, 63]

REVERSE SORT:

Reverse sorting gives the array sorted in descending order.

let arr = [15, 25, 58, 7, 2, 63];
let result = jsarraymethods.rev_sort(arr); //output should be [63, 58, 25, 15, 7, 2]

FIRST ELEMENT:

Finds the first element in the array.

let arr = [15, 25, 58, 7, 2, 63];
let result = jsarraymethods.first_element(arr); //output should be 15

LAST ELEMENT:

Finds the last element in the array.

let arr = [15, 25, 58, 7, 2, 63];
let result = jsarraymethods.last_element(arr); //output should be 63

MIDDLE ELEMENT:

Finds the middle element in a array.

let arr = [15, 25, 58, 7, 2, 63];
let result = jsarraymethods.middle_element(arr); //output should be 58

ARRAY LENGTH:

Finds the length of the array.

let arr = [15, 25, 58, 7, 2, 63];
let result = jsarraymethods.len_array(arr); //output should be 6

INDEX ELEMENT:

Finds the element at a particular index.

let arr = [15, 25, 58, 7, 2, 63];
let result = jsarraymethods.len_array(arr, 2); //output should be 58

JOIN-ASCENDING:

Joins two array and the resultant array would be sorted in ascending order.

let arr = [15, 25, 58, 7, 2, 63];
let arr1 = [84, 56, 42, 50, 35, 94];
let result = jsarraymethods.join_ascending(arr, arr1); //output will be [2, 7, 15, 25, 35, 42, 50, 56, 58, 63, 84, 94]

JOIN-DESCENDING:

Joins two array and the resultant array would be sorted in descending order.

let arr = [15, 25, 58, 7, 2, 63];
let arr1 = [84, 56, 42, 50, 35, 94];
let result = jsarraymethods.join_ascending(arr, arr1); //output will be [94, 84, 63, 58, 56, 50, 42, 35, 25, 15, 7, 2]

DELETE-LAST:

Removes last element from the array and returns the new array.

let arr = [15, 25, 58, 7, 2, 63];
let result = jsarraymethods.del_last(arr); //output will be [15, 25, 58, 7, 2]

DELETE-FIRST:

Removes the first element from the array and returns the new array

let arr = [15, 25, 58, 7, 2, 63];
let result = jsarraymethods.del_first(arr); //output will be [25, 58, 7, 2, 63]

DELETE-INDEX-ELEMENT:

let arr = [15, 25, 58, 7, 2, 63]
let result = jsarraymethods.del_index_element(arr, 2); //output will be [15, 25, 7, 2, 63]