
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
http-assert-value
Advanced tools
npm install http-assert-value --save
const assert = require('http-assert-value');
// Common assert interface
assert(+0 === -0, 'Zeros are not equal', 500, 'ZNE', {
leftOperand: +0,
reghtOperand: -0,
operation: '==='
}); // Ok
// Assert typed values
assert.identity('green-mile'); // Ok
assert.float('3.14'); // Ok
assert.positiveInt('12'); // Ok
assert.text('The Green Mile'); // Ok
// Assert by JSON schema
// @see: http://json-schema.org/
assert.bySchema('1', { type: 'integer' }); // Ok
// All methods have duplicates with `try...`
assert.text(undefined); // Error
assert.tryText(undefined); // Ok
try {
assert.text('DROP DATABASE BOOKS;');
} catch (error) {
error.message; // 'Text is invalid'
error.statusCode; // 400
error.options; // { value: 'DROP DATABASE BOOKS;', internalCode: '400_TVI' }
}
Assert value with http-specific error data
Any
- asserting valueString
- error textNumber
- error http-codeString
- three-letter error codeObject
- error additional informationAssert slug or unique identity value
String|Array<String>
- asserting valueString
- name of the parameter containing valueAssert float value
String|Array<String>
- asserting valueString
- name of the parameter containing valueAssert positive integer value
String|Array<String>
- asserting valueString
- name of the parameter containing valueAssert text, like search request
String|Array<String>
- asserting valueString
- name of the parameter containing valueAssert object by schema
Any|Array<Any>
- asserting valueObject
- json-schemaObject
- ajv constructor optionsAssert value, that it is in array
Any
- asserting valueArray
- array which contains expected valuesFunction
- function which compare values from array with asserting
value. By default used comparator to compare primitive ((lhs, rhs) => lhs === rhs
)Alias for assert.positiveInt
Assert that value length is less than passed maxLength
Any
- asserting valueNumber
- max allowed length of a stringString
- name of the parameter containing valueEvery method has try-version method, which has same interface and assert value, when value is passed:
FAQs
assert values with status codes
We found that http-assert-value 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
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.