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

deep-merge-test

v1.0.1

Published

A test bed to help you find the deep merge tool you need

Downloads

5

Readme

deep-merge-test

Find the deep merge tool you need!

What it is

This is a test bed for testing js methods, tools and utilities that execute deep merge of objects.

Deep merge is a costly and non-trivial operation, which can differ in implementation depending on the tool used, e.g. inherited and non-enumerable properties may or may not be copied to new object, etc.

A number of pre-defined tests are rigged up to test different aspects of deep merge operation by comparing original and new objects. Test suite is executed by Jest.

Test results will help you to understand the difference between the tools and choose the one that fot you most depending on the situation. You can also add another tool to the test and check how it compares.

Usage

  1. Clone this repository and run npm install to install dependencies, or install the whole package via npm. npm install deep-merge-test --save-dev

  2. Run npm test in this repository.

    TIP: if you have installed this package into subdirectory, you can use npm explore command to run test from parent directory npm explore deep-merge-test -- test

  3. You can watch the results in console (not very convenient, since there are too many), or in HTML form in tmp/reporters/jest-stare directory (generated by jest-stare reporter). Or use a reporter of your choice.

Tools pre-configured for testing

  • Object.assign (vanilla JS method)
  • jquery.extend
  • lodash.merge
  • lodash.assign
  • lodash.defaults
  • deep-extend
  • webpack-merge
  • nested-config
  • defaults(npm package)
  • merge-options
  • deepmerge

Add your own tools and tests

Install your tool as devDependency Manually edit merge.test.js - import your tool and include it in mergersSetup configuration object. Test suite will pick it up. You can also write your custom tests of course, PR's are welcome.

Features tested

  • nested objects
  • promises
  • functions
  • symbols
  • getters
  • arrays (replacement strategy expected)
  • no undefined properties copied over defined
  • no null properties copied over defined
  • inherited properties
  • non-enumerable properties
  • deep immutability
  • original object immutability
  • prototype references parent class

Note

In case you're wondering: Special comments starting with 🕮 are used my package Sidenotes and serve for annotation purposes, please do not delete them.