@woubuc/data-picker
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

Data Picker

A simple type-checking data validator and extractor.

The DataPicker class wraps an unknown object (e.g. from user input) and lets the user safely get values from it, ensuring that the returned values are of the correct type.

Usage Example

import { DataPicker } from '@woubuc/data-picker';

let env = new DataPicker('process.env', process.env);

// Returns the env 'NODE_ENV', or 'development' if the env doesn't exist
let node_env = env.getString('NODE_ENV', 'development');

// node_env is now guaranteed to contain a string

/@woubuc/data-picker/

    Package Sidebar

    Install

    npm i @woubuc/data-picker

    Weekly Downloads

    4

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    41.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • woubuc