Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flex-value

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-value

Strongly-typed, value-resolution handler.

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

flex-value

Build Status Coverage Status

Strongly-typed, value-resolution handler:

  • From a direct value
  • From value as a promise
  • From a callback that returns the value
  • From a callback that returns a promise

With support for generic error handling.


See Wiki for documentation and examples.

Install

npm i flex-value

Usage

import {Flex, FlexValue} from 'flex-value';

// fully-dynamic input/value:
const input: FlexValue<string>; // string | Promise<string> | (() => string | Promise<string>) 

// strongly-typed, actual value resolution:
const value: string = await Flex.get(input); 

And we can handle all types of errors in a generic way:

const onError = e => {
    // any error thrown or promise reject ends up here;
};

const value: string = await Flex.get(input, {onError});

Keywords

FAQs

Package last updated on 22 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc