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

@la40/js-helpers

v1.0.2

Published

Javascript helpers

Downloads

7

Readme

Javascript Helper Functions

Install

Via npm
$ npm i -S @la40/js-helpers
Via yarn
$ yarn add @la40/js-helpers

Use

import { arrayMove, isEmpty } from @la40/js-helpers;

Functions

arrayMove(arr, oldIndex, newIndex) ⇒ array

Move an array item from an index to another

Kind: global function
Returns: array - The new array

| Param | Type | | -------- | ------------------ | | arr | array | | oldIndex | int | | newIndex | int |

arrayToObjectByProperty(arr, property, compact) ⇒ object

Convert an array with objects to an object like {"property value x": [object x, object y ...], "property value y": [object z, object c ...]}

Kind: global function
Returns: object - The new object

| Param | Type | Description | | -------- | -------------------- | ----------------------------------------------------------------------------------------------------- | | arr | array | array with objects to convert | | property | string | property to use | | compact | boolean | default to true will remove the property from objects x,y,z,c , if false will leave the objects as is |

arrayContainsSomeArray(arr1, arr2) ⇒ boolean

Determine if an array contains one or more items from another array.

Kind: global function

| Param | Type | Description | | ----- | ------------------ | -------------------------------------------------- | | arr1 | array | the array to search | | arr2 | array | the array providing items to check for in the arr1 |

arrayGetFirstFoundInArray(arr1, arr2) ⇒ null | any

Get first found item in arr1.

Kind: global function
Returns: null | any - null when not found or the found item from arr1

| Param | Type | Description | | ----- | ------------------ | ------------------------------------------ | | arr1 | array | the array to get the first found item from | | arr2 | array | the array to search in |

stringToBoolean(string) ⇒ boolean

Convert boolean string like "false|no|0|''" to false everything else to true

Kind: global function

| Param | Type | | ------ | ------------------- | | string | string |

isEmpty(value) ⇒ boolean

Check if value not empty (null,'',undefined,{},{ k1: null, k2: "" },[],[null,''])

Kind: global function

| Param | Type | | ----- | ---------------- | | value | any |

isEuDateTime(euDateTimeString) ⇒ boolean

Check if given string fulfill european data time format dd.mm.yyyy hh:mm:ss

Kind: global function

| Param | Type | | ---------------- | ------------------- | | euDateTimeString | string |

isDeepEqual(object1, object2) ⇒ boolean

Check if two objects are deep equal

Kind: global function

| Param | Type | | ------- | ------------------- | | object1 | object | | object2 | object |

isObject(o) ⇒ boolean

Check if an object inherits Object, {}

Kind: global function

| Param | Type | | ----- | ------------------- | | o | object |

recursiveDeepCopy(o) ⇒ object

Will create a recursive deep copy of an object

Kind: global function

| Param | Type | | ----- | ------------------- | | o | object |

Testing

$ npm run test

Change log

Please see CHANGELOG for more information on what has changed recently.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.