Catalog npm
Back to packageRELEASE DETAILS

0.8.1

npm

3h-validate

A runtime validator.

checkobjectruntimetypevalidatevalidationvalidator
Published24 Jan 2024
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-fPJaGfv1/thwaoLlv/Q7hfZIfmXyltAJp6U0/hFtEjzOCRy4k4bsJg2+KiA+6fMuirmPv60p1VIDYJx9Ki52DQ==",
  "shasum": "3a6065f5a660eff98f96c41d2f96a9ee987d09c0",
  "tarball": "https://registry.npmjs.org/3h-validate/-/3h-validate-0.8.1.tgz",
  "fileCount": 21,
  "unpackedSize": 72303,
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIGkQ/dNcalHOVqh5+xXjOR3AlDmKvoKg2u03miIA/StNAiAXTDRH2KmfUtHm8XfykyoF5POvNKfQFL0QbK95GASBUQ=="
    }
  ]
}

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:509e71ae869c81e857173dd0952377b51ecb59464e293dbbc785ddd88f867f0d

Other collected versions

0.8.224 Jan0.8.024 Jan0.7.124 Jan0.7.07 Dec0.6.030 Oct0.5.127 SeptView all collected versions →