Catalog npm
Back to packageRELEASE DETAILS

0.5.1

npm

3h-validate

A runtime validator.

checkobjectruntimetypevalidatevalidationvalidator
Published27 Sept 2022
Direct dependencies10
Transitive dependenciesNot calculated

README

Current package documentation

3h-validate

A runtime validator.

Examples

Type Validation

import { types } from '3h-validate';
// or: const { types } = HV;

const validator = types.number({
    integersOnly: true,
    min: 0,
    includeMin: false,
});

if (validator.test(1)) {
    console.log('1 is a valid value.');
}

validator.validate(0); // RangeError: the number is too small

Versioned Data Management

import { types, Specification } from '3h-validate';
// or: const { types, Specification } = HV;

const spec1 = new Specification({
    version: 'v1',
    validator: types.number(),
});

const spec2 = new Specification({
    version: 'v2',
    validator: types.string(),
    previousSpecification: spec1,
    updater: String,
});

const versionedData = {
    version: 'v1',
    data: 3.14,
};

console.log(spec1.test(versionedData)); // true

console.log(spec2.transform(versionedData));
// { version: 'v2', data: '3.14' }

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 10

Native requirements
10 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
3h-utils
Environment
{
  "local_name": "3h-utils",
  "alias": false,
  "peer_metadata": null
}
^0.6.0runtime
@babel/core
Environment
{
  "local_name": "@babel/core",
  "alias": false,
  "peer_metadata": null
}
^7.17.0development
@babel/preset-env
Environment
{
  "local_name": "@babel/preset-env",
  "alias": false,
  "peer_metadata": null
}
^7.16.0development
@rollup/plugin-babel
Environment
{
  "local_name": "@rollup/plugin-babel",
  "alias": false,
  "peer_metadata": null
}
^5.3.0development
@rollup/plugin-node-resolve
Environment
{
  "local_name": "@rollup/plugin-node-resolve",
  "alias": false,
  "peer_metadata": null
}
^14.1.0development
3h-test
Environment
{
  "local_name": "3h-test",
  "alias": false,
  "peer_metadata": null
}
^0.8.0development
dts2md
Environment
{
  "local_name": "dts2md",
  "alias": false,
  "peer_metadata": null
}
^0.4.0development
rollup
Environment
{
  "local_name": "rollup",
  "alias": false,
  "peer_metadata": null
}
^2.70.0development
terser
Environment
{
  "local_name": "terser",
  "alias": false,
  "peer_metadata": null
}
^5.12.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^4.6.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-7S6e4uzAX7npb54AARb6aUTl+gq1q52AwhiS9TKfZGzG9icoFcLsmlXRQX4N5TWFjNQBo7z6IAatWX+jgOFWEw==",
  "shasum": "0beec2211a971f0ff5dae8e49700af410028c78c",
  "tarball": "https://registry.npmjs.org/3h-validate/-/3h-validate-0.5.1.tgz",
  "fileCount": 21,
  "unpackedSize": 69447,
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIGsvnFoc8hz6UgZHqjTaupbTaL4rq6DPjKQf9bYloHsSAiByuoqn99HMc6JvGOsjRbtsJHS0NxpzBYfHnZ8bcdlQVw=="
    }
  ],
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjMlF1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpMGA/9HaQgM/8ORtH3oLp/+izok4QQ9EU93KDtVs6EpG9PtOzcFJnx\r\nbawRqyvT+PjKWc3KPxyWFJ6TfxiQyqRXNflH1oMVsqQ7hE2o2iY8962N2/Jv\r\nq7CJGleRAMbqyfaJ0O8phAt6wU6vWfwpNrifb0L587joheOjScgRebdqisxX\r\nEhOuEb25NawdNKjCqbrPN/4txv9sLC+OAfOVcbdpj/5hQT4nZ9+1Dy3bCpTr\r\nYDrEuwehz1gN3+ozA/n1qhZLuYgKi2t4CDP3o3LrxyRK+TbI/7txEsQ2ioLR\r\nU3qyOTtBcWFyvPyQ/M19BdsObcDVLcilOq9NsGQ4eIiD/YJMHYmj7ZLcQGXf\r\n5nIl1DWyX/k7lEwrBNpRWnctsBYkOWHLkFWNhcv6MaxKbA5uC/8lMbHnq2sL\r\nKO6tfVbSmgdt/UnYKh5RYcL+QpJ9x9W/Gz7yH1bhLLB5LlXiOwqt8wMqSM0c\r\n7RXHrJMF8NXqViIlIacovpat8yX+ehxTbxQB2Ho4DgQUnGmoE3ecZLdK1EiU\r\n2kMll12ej3grYhbzXlyKgizrDyaAuXc4MM5ayCsBKv/JVtUL/Ck8LrikQt+Q\r\neR/Ioi2NE8J1vXmcIYyvE2Z+aaJzd4YHunVl49/ha7PVWhYwU66+/Oq8/1Xu\r\nVRmrSLyG1Gmisqzku9TMY4k7UdreSCAkHMo=\r\n=An0u\r\n-----END PGP SIGNATURE-----\r\n"
}

Repository

PENDING
huang2002/3h-validate

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:43 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:7b22c2dfac0c65ace6ef850c13abe6ca0cea36012d5fb47db885e57cd2ebbf82

Other collected versions

0.8.224 Jan0.8.124 Jan0.8.024 Jan0.7.124 Jan0.7.07 Dec0.6.030 OctView all collected versions →