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

@silvermine/chai-strictly-equal

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@silvermine/chai-strictly-equal

Chai assertion library plugin to add `strictlyEqual` function and disable `equal`

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
475
increased by49.84%
Maintainers
3
Weekly downloads
 
Created
Source

Silvermine Chai Strictly Equal Plugin

Build Status Coverage Status

What is it?

A plugin for the Chai Assertion Library that adds a .strictlyEqual method, and disables the .equal method.

Why?

Because the difference in .eql (deep equality) and .equal (strict equality) is way too subtle. Chai provides .deep modifier that modifies .equal to be a deep equality check (as if it were .eql), further complicating the matter. It would be nice if there were a .strictly modifier so that you could do .to.strictly.eql(foo), but that doesn't exist, and would be more difficult to add. So, for any Silvermine codebases where we are using chai, we will use this plugin and prohibit the use of .equal, replacing it with .strictlyEqual to be more easily readable - especially for developers not familiar with our codebase.

How do I use it?

var chai = require('chai');

chai.use(require('@silvermine/chai-strictly-equal'));

Or, if you are using TypeScript:

import chai from 'chai';
import enableStrictlyEqual from '@silvermine/chai-strictly-equal';

chai.use(enableStrictlyEqual);

That's all there is to it. Then your .equal calls will throw an error, indicating that you should replace them with .eql or .strictlyEqual.

How do I contribute?

We genuinely appreciate external contributions. See our extensive documentation on how to contribute.

License

This software is released under the MIT license. See the license file for more details.

Keywords

FAQs

Package last updated on 30 May 2024

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