Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@dmail/assert
Advanced tools
[![npm package](https://img.shields.io/npm/v/@dmail/assert.svg)](https://www.npmjs.com/package/@dmail/assert) [![build](https://travis-ci.com/dmail/assert.svg?branch=master)](http://travis-ci.com/dmail/assert) [![codecov](https://codecov.io/gh/dmail/asser
compare actual and expected, if they differ throw an error
assert
is a function receiving actual
and expected
with the following signature.
assert({ actual, expected })
assert
do nothing if actual
and expected
comparison is successfull.
assert
throw an error if actual
and expected
comparison is a failure.
assert
comparison behaviouractual
and expected
can be different objects but they must deeply look alike in every aspects possible in JavaScript.
const actual = new Error("message")
const expected = new Error("message")
const actual = Object.create(null)
const expected = Object.create(null)
const actual = new Date()
const expected = new Date()
const actual = /ok/
const expected = /ok/
const actual = new TypeError()
const expected = new Error()
const actual = 10
const expected = "10"
const actual = new String("foo")
const expected = "foo"
const actual = { foo: true }
const expected = { foo: false }
const actual = { foo: true, bar: true }
const expected = { bar: true, foo: true }
const actual = Object.defineProperty({}, "answer", { value: 42 })
const expected = { answer: 42 }
npm install --save-dev @dmail/assert
You can refer on browser example and node example below to go further.
<script src="https://unpkg.com/@dmail/assert@latest/dist/global/main.js"></script>
<script>
const { assert } = window.__dmail_assert__
assert({
actual: { foo: false },
expected: { foo: true },
})
</script>
Screnshot below is a part of console content after executing above code inside chrome.
const { assert } = require("@dmail/assert")
assert({
actual: { foo: false },
expected: { foo: true },
})
Screnshot below is a part of terminal output after executing above code inside node.js.
— see https://dmail.github.io/assert/browser-example.
FAQs
[![npm package](https://img.shields.io/npm/v/@dmail/assert.svg)](https://www.npmjs.com/package/@dmail/assert) [![build](https://travis-ci.com/dmail/assert.svg?branch=master)](http://travis-ci.com/dmail/assert) [![codecov](https://codecov.io/gh/dmail/asser
We found that @dmail/assert demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.