@robinpath/assert
Advanced tools
+98
| # @robinpath/assert | ||
| > Testing assertions: equal, deepEqual, truthy, falsy, type checks, includes, matches, throws, and more | ||
|     | ||
| ## Why use this module? | ||
| The `assert` module lets you: | ||
| - Assert two values are strictly equal (===) | ||
| - Assert two values are not equal | ||
| - Assert deep equality of two values | ||
| - Assert value is truthy | ||
| - Assert value is falsy | ||
| All functions are callable directly from RobinPath scripts with a simple, consistent API. | ||
| ## Installation | ||
| ```bash | ||
| npm install @robinpath/assert | ||
| ``` | ||
| ## Quick Start | ||
| No credentials needed — start using it right away: | ||
| ```robinpath | ||
| assert.notEqual $a $b | ||
| ``` | ||
| ## Available Functions | ||
| | Function | Description | | ||
| |----------|-------------| | ||
| | `assert.equal` | Assert two values are strictly equal (===) | | ||
| | `assert.notEqual` | Assert two values are not equal | | ||
| | `assert.deepEqual` | Assert deep equality of two values | | ||
| | `assert.truthy` | Assert value is truthy | | ||
| | `assert.falsy` | Assert value is falsy | | ||
| | `assert.isNull` | Assert value is null or undefined | | ||
| | `assert.isNotNull` | Assert value is not null/undefined | | ||
| | `assert.isType` | Assert typeof value matches expected type | | ||
| | `assert.includes` | Assert array/string includes a value | | ||
| | `assert.matches` | Assert string matches a regex pattern | | ||
| | `assert.throws` | Assert that a function throws | | ||
| | `assert.lengthOf` | Assert array/string has specific length | | ||
| | `assert.hasProperty` | Assert object has a specific property | | ||
| | `assert.isAbove` | Assert number is above threshold | | ||
| | `assert.isBelow` | Assert number is below threshold | | ||
| ## Examples | ||
| ### Assert two values are not equal | ||
| ```robinpath | ||
| assert.notEqual $a $b | ||
| ``` | ||
| ### Assert deep equality of two values | ||
| ```robinpath | ||
| assert.deepEqual $obj1 $obj2 | ||
| ``` | ||
| ### Assert value is truthy | ||
| ```robinpath | ||
| assert.truthy $val | ||
| ``` | ||
| ## Integration with RobinPath | ||
| ```typescript | ||
| import { RobinPath } from "@wiredwp/robinpath"; | ||
| import Module from "@robinpath/assert"; | ||
| const rp = new RobinPath(); | ||
| rp.registerModule(Module.name, Module.functions); | ||
| rp.registerModuleMeta(Module.name, Module.functionMetadata); | ||
| const result = await rp.executeScript(` | ||
| assert.notEqual $a $b | ||
| `); | ||
| ``` | ||
| ## Full API Reference | ||
| See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples. | ||
| ## Related Modules | ||
| - [`@robinpath/json`](../json) — JSON module for complementary functionality | ||
| ## License | ||
| MIT |
+25
-7
| { | ||
| "name": "@robinpath/assert", | ||
| "version": "0.1.0", | ||
| "publishConfig": { "access": "public" }, | ||
| "version": "0.1.1", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "type": "module", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "exports": { ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" } }, | ||
| "files": ["dist"], | ||
| "scripts": { "build": "tsc", "test": "node --import tsx --test tests/*.test.ts" }, | ||
| "peerDependencies": { "@wiredwp/robinpath": ">=0.20.0" }, | ||
| "devDependencies": { "@wiredwp/robinpath": "^0.30.1", "tsx": "^4.19.0", "typescript": "^5.6.0" } | ||
| "exports": { | ||
| ".": { | ||
| "import": "./dist/index.js", | ||
| "types": "./dist/index.d.ts" | ||
| } | ||
| }, | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "test": "node --import tsx --test tests/*.test.ts" | ||
| }, | ||
| "peerDependencies": { | ||
| "@wiredwp/robinpath": ">=0.20.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@wiredwp/robinpath": "^0.30.1", | ||
| "tsx": "^4.19.0", | ||
| "typescript": "^5.6.0" | ||
| } | ||
| } |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
31250
9.58%10
11.11%0
-100%99
Infinity%1
Infinity%