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

@octoguide/array-utils

v1.0.6

Published

<dl> <dt><a href="#filterDuplicatesById">filterDuplicatesById</a></dt> <dd><p>Remove entires from source that exist in duplicates</p> </dd> <dt><a href="#notDuplicateById">notDuplicateById</a></dt> <dd><p>call using the array filter method - refer to filt

Downloads

2

Readme

Constants

filterDuplicatesById

Remove entires from source that exist in duplicates

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | source | * | the list to remove duplicates from i.e. surveyQuestions | | duplicates | * | the duplicates to check - assumes it is the id field i.e. the items already selected surveyGroups.questions - map to id field in the list |

notDuplicateById

call using the array filter method - refer to filterDuplicatesById

Kind: global constant

| Param | Type | | --- | --- | | currentValue | * |

uniqueSymmetricDifference

take 2 arrays that have the key of id an return an array that has no common objects Handy for lists that don't require object that have already been selected.

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | array1 | * | one array of objects | | array2 | * | another array of objects |

unionWith

All array A items will end up in the result. array b items - Only NON duplicates from array A will be added using the comparator

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | a | Array | | | b | Array | | | comp | function | the comparator to match items from array A with Array B |

differenceBy

Returns items from array A that ARE NOT in array B (NOTE - If items from B are not in A - they will not be in the result)

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | a | Array | | | b | Array | | | comp | function | the comparator that finds the difference in the 2 arrays |

differenceById

Wrapper for differenceBy that uses the object id as the comparator

Kind: global constant

| Param | Type | | --- | --- | | a | * | | b | * |

sameBy

Returns items from array A that ARE NOT in array B (NOTE - If items from B are not in A - they will not be in the result)

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | a | Array | | | b | Array | | | comp | function | the comparator that finds the difference in the 2 arrays |

sameByIdValue

Wrapper for differenceBy that uses the object id as the comparator

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | a | Array | objects that have an id field [{id: 'id1'}, {id: 'id3'}] | | b | Array | Array of value that contain the id value to lookup ['id1', 'id2'] |

addOrUpdateEntry

update the entry in the list based on the id of the object

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | list | * | the list to update | | payload | * | the payload to add or update |

uniqByKeepFirst

find an object by its key, return the first instance in the list

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | a | * | the list of objects | | key | * | the object key to return |

uniqByKeepLast

find an object by its key, return the last instance in the list

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | a | * | the list of objects | | key | * | the object key to return |

removeDuplicatesById

remove array object duplicated by the 'id' field

Kind: global constant

| Param | Type | Description | | --- | --- | --- | | array | * | the list of objects |