Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

samsam

Package Overview
Dependencies
Maintainers
5
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

samsam

Value identification and comparison functions

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
504K
decreased by-42.93%
Maintainers
5
Weekly downloads
 
Created

What is samsam?

The samsam npm package is a utility library for JavaScript that provides functions for deep equality comparisons, type checking, and other utilities useful for testing and assertions.

What are samsam's main functionalities?

Deep Equality Comparison

This feature allows you to compare two objects deeply to check if they are equal. It is useful for testing and assertions where you need to ensure that two complex objects have the same structure and values.

const samsam = require('samsam');
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { a: 1, b: { c: 2 } };
console.log(samsam.deepEqual(obj1, obj2)); // true

Type Checking

Samsam provides functions to check the type of various JavaScript objects, such as whether an object is an arguments object or a DOM element. This is useful for writing more robust tests.

const samsam = require('samsam');
console.log(samsam.isArguments(arguments)); // true if 'arguments' object
console.log(samsam.isElement(document.createElement('div'))); // true if DOM element

Match Function

The match function allows you to check if an object matches a given pattern. This is useful for partial comparisons in tests where you only care about certain properties of an object.

const samsam = require('samsam');
const obj = { a: 1, b: 2 };
const matcher = { a: 1 };
console.log(samsam.match(obj, matcher)); // true

Other packages similar to samsam

FAQs

Package last updated on 03 Oct 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc