New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

11

assert.js

@@ -34,3 +34,4 @@ import {deepEqual} from './deep-equal.js'

*/
export default function(op, val, ref, msg) {
export default function assert(op, val, ref, msg) {
if (isTag(op)) return assert.bind(null,t(...arguments))
const not = op[0] === '!' && op.length > 1,

@@ -45,1 +46,9 @@ key = not ? op[1] === '=' ? op.slice(1) + '=' : op.slice(1) : op,

}
function isTag(a0) {
return Array.isArray(a0) && Array.isArray(a0.raw)
}
function t(a0, ...as) {
let t=a0[0], i=0
while(i<a0.length-1) t += as[i]+a0[++i]
return t
}

2

package.json

@@ -6,3 +6,3 @@ {

"browser": "./index.js",
"version": "1.0.0",
"version": "1.1.0",
"description": "assertions using comparison operators",

@@ -9,0 +9,0 @@ "keywords": [

@@ -20,6 +20,6 @@ <!-- markdownlint-disable MD004 MD007 MD010 MD041 MD022 MD024 MD032 MD036 -->

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`!==`(3, 4, 'should be unequal')
a`<`(1, 2)
a`!`(null, 'should be falsy')
a`!{===}`([], 'str', 'should be notDeepStrictEqual')
a('{==}', [2], 2, 'should be deepEqual')

@@ -26,0 +26,0 @@ a('!==', 3, 4)

@@ -36,2 +36,14 @@ // @ts-ignore

t('tag `===`, `!==`, `==`, `!=`', a => {
a`===`(2, 2)
a`===`(2, 2)
a`throws`(()=>{ a`===`({}, {}) }, /^\{} === {}$/, 'valid message')
a`!==`({}, {})
a`throws`(()=>{ a`!==`(2, 2) }, /^2 !== 2$/, 'valid message')
a`==`(null, undefined)
a`throws`(()=>{ a`==`(null, false) }, /^null == false$/, 'valid message')
a`!=`(undefined, true)
a`throws`(()=>{ a`!=`(undefined, null) }, /^undefined != null$/, 'valid message')
})
t('>, <, >=, <=, !>, !<, !>=, !<=', a => {

@@ -38,0 +50,0 @@ a('>', 3, 2)

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