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 🙏

© 2026 – Pkg Stats / Ryan Hefner

smart-merger

v1.1.11

Published

This is a package consist of helpers for merging js objects. Also, you can import redux helpers for merging data in reducers. Link to the source code <a href="https://github.com/Lkrm/smart-merger"> https://github.com/Lkrm/smart-merger </a>

Readme

This is a package consist of helpers for merging js objects. Also, you can import redux helpers for merging data in reducers. Link to the source code https://github.com/Lkrm/smart-merger

Base functionality:

  • mergeIn(source, destination, options?) - deep merge "destination" in "source"

  • mergeByProp(prop, source, destination, options?) - deep merge "destination" in "source" by property

  • mergeByPath(path<Array>, source, destination, options?) - deep merge "destination" in "source" by path

  • replaceIn(source, destination) - set "destination" in "source" ( Same as object assignee )

  • replaceByProp(prop, source, destination) - set "destination" in "source" by property

  • replaceByPath(path<Array>, source, destination) - set "destination" in "source" by path

  • replaceByFunc(source, fn(source, key, value, currentEnitity)) - set data by function. This function will call for each item in a data. You can check currentEntity type and change value and key for an object.

Base functionality example ( set post by path ):

 const postsData = { 
  data: {
   entities: { 
     posts: [post1, post2]
    }
  }
};
const newPostsData = mergeByPath(['data', 'entities', 'posts'], postsData, newPost)
// For now newPostsData consits newPost

I am recommend you use these helpers with redux-actions, see examples below:

import { mergeByPath, replaceByFunc } from 'smart-merger/redux';
// handlerActions by redux-actions
handleActions({
   SET_USER: mergeByPath(['entities', 'users'], ({ payload: user }, state) => (user))
   SET_FRUITS: replaceByFunc(({ payload: { from, to }}) => (source, key, value, currentEntity) => {
      if (value === from) {
             if (Array.isArray(currentEntity)) {
                return to;
              }
             return { [key]: to };
         }
      } 
    )
}, initialState);


Redux functionality example (append user to store by path):

// Reducer
import { mergeByPath } from 'smart-merger/redux';
function addUser(state, action){
if (typeof action.state === 'SET_USER') {
    return mergeByPath(['entities', 'users'], ({ payload: user }, state) => (user), state, action)
  }
  return state
}

#Helpers for merging have options

  • customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined; - You can change behavior for merging a specific part of your data.

  • arrayMerge?(target: any[], source: any[], options?: Options): any[]; - Change behavior for merging arrays in your data.

  • isMergeableObject?(value: object): boolean; - You may not want this, if your objects are of special types, and you want to copy the whole object instead of just copying its properties.

  • clone?: boolean; - Defaults to true. If clone is false then child objects will be copied directly instead of being cloned. This was the default behavior

You can find more information about this options here deepmerge .

#You can import next common helpers from the package:

  • curry(fn) - make this fn as curried
  • path(path<Array>, data) - get data by path
  • pathOr(or, path<Array>, data) - get data by path or return or value if path is not exist
  • accosPath(arrayPath<Array>, data, source) - set data by path to an object
  • prop(prop, data) - get prop
  • propOr(or, prop, data) - get prop or return or value
  • dataAssigneeByType(firstData, secondData) - merging two arrays or two objects

You can import it from smart-merger/helpers. All helpers were curried.