Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@sinonjs/samsam
Advanced tools
The @sinonjs/samsam package is a library designed for deep comparison and matching of objects, arrays, and other JavaScript data types. It is particularly useful in the context of testing, where developers need to assert the equality of complex objects and arrays.
Deep equality
This feature allows for the deep comparison of objects, arrays, and other complex data structures to determine if they are equal in structure and content.
const samsam = require('@sinonjs/samsam');
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { a: 1, b: { c: 2 } };
console.log(samsam.deepEqual(obj1, obj2)); // outputs: true
Match object properties
This functionality enables matching objects against specified criteria, useful for asserting the presence of certain properties or property values within an object.
const samsam = require('@sinonjs/samsam');
const obj = { a: 1, b: 2 };
console.log(samsam.match(obj, { a: 1 })); // outputs: true
Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework. It offers similar deep equality assertions and matchers but with a more extensive plugin ecosystem and chainable methods, providing a more flexible and expressive approach compared to @sinonjs/samsam.
This package provides a simple and straightforward implementation of deep equality comparison. While it covers the basic need of deep equality checks, it lacks the additional matching capabilities and custom assertions provided by @sinonjs/samsam.
Value identification and comparison functions
Documentation: http://sinonjs.github.io/samsam/
Support us with a monthly donation and help us continue our activities. [Become a backer]
Become a sponsor and get your logo on our README on GitHub with a link to your site. [Become a sponsor]
samsam was released under BSD-3
6.1.3
15295d9
Fix #237: Use jQuery#is() for jQuery equality (Morgan Roderick)
In f1a1f306018166ad76ab1a1a71d400fc9373f7d0 we added support for Javascript iteraction protocols.
jQuery objects happen to have iteration protocols, so they would trigger the new codepath. However, that code path uses
Array.from
on the input, which doesn't play nice with jQuery's serializer.Luckily, jQuery has the
is()
method for comparing its objects.
Released by Morgan Roderick on 2022-11-02.
FAQs
Value identification and comparison functions
The npm package @sinonjs/samsam receives a total of 3,321,790 weekly downloads. As such, @sinonjs/samsam popularity was classified as popular.
We found that @sinonjs/samsam demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.