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

assert-op

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assert-op

assertions using comparison operators

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
increased by225%
Maintainers
1
Weekly downloads
 
Created
Source

assert-op

assertions with javascript comparison operators

WhyExampleFeaturesLicense

Why

This originated as an attempt to have assertions that are less verbose because assert.notDeepStrictEqual and the likes are ugly.

Example

import t from 'assert-op'

t('mytest', a => {
  a('==', 2, 2)
  a`==`(2, 2, 'this alternate form is also possible')
  a`!==`(3, 4, 'should be unequal')
  a`<`(1, 2)
  a`!`(null, 'should be falsy')
  a`!{===}`([], 'str', 'should be notDeepStrictEqual')
  a('{==}', [2], 2, 'should be deepEqual')
  a('!==', 3, 4)
  a('{===}', new Set([1,2]), new Set([1,2]))
  a('{===}', new Map([[1,2]]), new Map([[1,2]]))
})

Features

  • Javascript Comparison Operators (==, !==, ===, !===, <, <=, >, >=)
  • Negation (!, !!)
  • Other symbols for nested object
    • {==}: deepEqual
    • !{==}: notDeepEqual
    • {===}: strictDeepEqual
    • !{===}: notStrictDeepEqual
  • throws and !throws for assert.throws
  • Support ES2015 Set and Map

License

MIT © Hugo Villeneuve

Keywords

FAQs

Package last updated on 02 Jul 2021

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