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

funcwizard

v1.0.5

Published

functions to make developer's work easier

Downloads

4

Readme

What is this

This package provide functions to simplify development process

Installation

npm i funcwizard

Importing

const funcwizard=require('funcwizard');

Available Functions

concat

Concatinates all given array and return it.

let arr=[4]
let result =funcwizard.concat([1,2,3],arr,[5])//result will be [1,2,3,4,5]

chunk

Divides the array into blocks of given number and return it.

let result =funcwizard.chunk(['a', 'b', 'c', 'd'], 3)//result will be [["a", "b", "c"], ["d"]]
let result =funcwizard.chunk(['a', 'b', 'c', 'd'], 2)//result will be [["a", "b"], ["c", "d"]]

initial

Gets all but the first element of array

let result =funcwizard.initial(['s','w', 'b', 'c', 'd','e'])//result will be ["w", "b", "c", "d", "e"]

indexof

Find the index of the given number and also give optional parameter to specify from where the search should start.

let result =funcwizard.indexof([1,0,2, 1, 2], 2) //result will be 2
let result =funcwizard.indexof([1,0,2, 1, 2], 2,3) //result will be 4

join

Gets an array and joins then with any string inbetween each element of the array and returns a string.

let result =funcwizard.join([1,0,2, 1, 2], "~") //result will be "1~0~2~1~2"
let result =funcwizard.join(['a', 'b', 'c'], "&") //result will be "a&b&c"

last

Returns the last element of the array

let result =funcwizard.last([1, 2, 3,4]) //result will be 4

nth

Returns the element in the given position

options
  • positive position-returns from the start
  • negatice position-returns from the end
let array = ['a', 'b', 'c', 'd'];
let result =funcwizard.nth(array, 1) //result will be 'b'
let result1 =funcwizard.nth(array, -1) //result will be 'd'

sum

Returns the sum of the array

let result=funcwizard.sum([1,2,3]); //result will be 6

min

Returns the minimum value in an array

let result=funcwizard.min([4, 2, 8, 6]); //result will be 2
let result=funcwizard.min([]); //result will be 'undefined'

max

Returns the maximum value in an array

let result=funcwizard.max([4, 2, 8, 6]); //result will be 8
let result=funcwizard.max([]); //result will be 'undefined'

size

Returns the size of object,array and string.

let result=funcwizard.size([1, 2, 3]); //result will be 3
let result=funcwizard.size({ 'a': 1, 'b': 2 }); //result will be 2
let result=funcwizard.size('pebbles'); //result will be 7

deepcopy

Copy an object by value for nested objects and not by reference with this function

let result=funcwizard.deepcopy({ 'a': 1, 'b': {'c':2} }); //result contained copy of the object without same reference.

dropright

Removes the given number of elements from the end of the array Default value to remove is 1

let result=funcwizard.dropright([1,2,3,4]); //result will be [1,2,3]
let result=funcwizard.dropright([1,2,3,4],0); //result will be [1,2,3,4]
let result=funcwizard.dropright([1,2,3,4],2); //result will be [1,2]
let result=funcwizard.dropright([1,2,3,4],5); //result will be []

dropleft

Removes the given number of elements from the start of the array Default value to remove is 1

let result=funcwizard.dropright([1,2,3,4]); //result will be [2,3,4]
let result=funcwizard.dropright([1,2,3,4],0); //result will be [1,2,3,4]
let result=funcwizard.dropright([1,2,3,4],2); //result will be [3,4]
let result=funcwizard.dropright([1,2,3,4],5); //result will be []

dropboth

Removes the given number of elements from both starting and ending of the array. Default value to remove is 1

let result=funcwizard.dropboth([1,2,3,4,5,6]); //result will be [2,3,4,5]
let result=funcwizard.dropboth([1,2,3,4,5,6],0); //result will be [ 1, 2, 3, 4, 5, 6 ]
let result=funcwizard.dropboth([1,2,3,4,5,6],2); //result will be [3,4]
let result=funcwizard.dropboth([1,2,3,4,5,6],5); //result will be []