Current collected state Current
Observed since 20 Oct, 22:04 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
@0bdx/ainta
Utilities for validating values in 0bdx apps, libraries and websites.
Utilities for validating values in apps, libraries and websites.
∅ Version: 0.0.20
∅ NPM: https://www.npmjs.com/package/@0bdx/ainta
∅ Repo: https://github.com/0bdx/ainta
∅ Homepage: https://0bdx.com/ainta
@TODO add an overview
import { aintaBoolean } from '@0bdx/ainta';
aintaBoolean(true);
// false
aintaBoolean(1234);
// "A value is type 'number' not 'boolean'"
aintaBoolean(null, 'isDone', { begin:'doThings()' });
// "doThings(): `isDone` is null not type 'boolean'"
narrowAintas() helper:In the example below, narrowAintas() is used to narrow aintaNumber()
into aintaNatural(), and then capture its validation results:
begin:'bothNatural()' sets a prefix, added to all explanationsgte:0 checks that the value is not negativemod:1 checks that the value is an integerlte:1000 and lte:50 specify different maximum values for each argumentif (results.length) checks whether there were any problemsimport narrowAintas, { aintaNumber } from '@0bdx/ainta';
function bothNatural(a, b) {
const [ results, aintaNatural ] = narrowAintas(
{ begin:'bothNatural()', gte:0, mod:1 },
aintaNumber
);
aintaNatural(a, 'a', { lte:1000 });
aintaNatural(b, 'b', { lte:50 });
if (results.length) return results;
return "a and b are both natural numbers, in range!";
}
bothNatural(-5, 12.34);
// [ "bothNatural(): `a` -5 is not gte 0",
// "bothNatural(): `b` 23.45 is not divisible by 1" ]
bothNatural(99, 200);
// [ "bothNatural(): `b` 200 is not lte 50" ]
bothNatural(12, 3);
// "a and b are both natural numbers, in range!"
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
@0bdx/build-helpersEnvironment{
"local_name": "@0bdx/build-helpers",
"alias": false,
"peer_metadata": null
} | ^0.0.4 | development |
@rollup/plugin-terserEnvironment{
"local_name": "@rollup/plugin-terser",
"alias": false,
"peer_metadata": null
} | ^0.4.0 | development |
rollupEnvironment{
"local_name": "rollup",
"alias": false,
"peer_metadata": null
} | ^3.18.0 | development |
Source distribution
{
"integrity": "sha512-bNQgfXXPqK3QV6fJ+OS8xTXlr8GV/bnNCsiufwv5RqSs6c6F1uwkdRn3J8Pmhr/wSoJS9+Ao+NEMjt76nHd4Jg==",
"shasum": "d7f26433c0d356a1bc1b5423acbec7ab3b2707b1",
"tarball": "https://registry.npmjs.org/@0bdx/ainta/-/ainta-0.0.8.tgz",
"fileCount": 6,
"unpackedSize": 81369,
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEUCIQCUiW21GB2sTsaM0Bma978EH1hSRilE0ekRg8oirdpIqgIgN7Gw24eq+XYr2R0GfLLsrjy2F/sUcICKvkzBIkFaYEk="
}
],
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJE47ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr9ThAAkW9wGWxpA+09Aq6q7yD/0dxHzI1OZmFEbxIeykFDcqqewmkf\r\nbQ5wQRPZ5zBnhUTevpZY7i988aI4Aeyhgv014JXP0nZxmWGEdT3H+QVHJNMZ\r\nOVC3mM9uS3yXKG/uCu6QO9r9DjDDx9iOXtuGKoGWmANokFYP+jpMQmiTVJ1v\r\nwdfin6gGSbfQ6yv2IpZpfKb3fuLnD1AdTbmge8tPO7hrJLGiHqpbBUHtC9e0\r\nksheTUClr7fvgc2HNkDtMuY4aTfltxmFwuoyuZsWsES+DVZOnVk/qkyoPXax\r\naCD0Mc8FwtAtUweCkqgpjiE3szCTHyPf6NtZXe7Pp6PY3MQV70Qa3jvhx2/z\r\nNvJvEuQPtOjN1hsnh0lDKYNcy52lnvGHy5hWqrbuFhrSSL5/j284ZthroHo5\r\nxIaKSiw2jPijQFCs5UVVXImBvvwVcEdeIoDLPgFoUUydqDhNDulHvlMNjQjx\r\nOVn2dUf0CRFeOnWSF7HA1F5+beEa1juTn9WzcEWjYNfi0cC3apBXB7og35Oz\r\ncMf/WJJBF2X8ZxBniy8frzW+cUNXJBGUlaW/1wHbsTPRmG39utYwwkgM4n+A\r\nA7L8yNmnPT2nsoBlb+HOUQexxsb11Q/K+tLs2bjcucUm1PFnK2BzFbTng53A\r\npSMHeHaRZ+8bwclo8E8eeVmwSgWpbVS5gOs=\r\n=wkia\r\n-----END PGP SIGNATURE-----\r\n"
}Observed since 20 Oct, 22:04 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:c50b4e61fb7aa7dbf948549fb836f980bc2cbed5ef623f7a1ce83abbe2f9337e