Socket
Socket
Sign inDemoInstall

fputils

Package Overview
Dependencies
Maintainers
3
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fputils

some common util methods


Version published
Weekly downloads
30
increased by900%
Maintainers
3
Weekly downloads
 
Created
Source

FP utils

A bunch of useful utility functions

Examples

Either

import { either, Either, Right, Left } from 'fputils';

// define fetch function, this function does not throw, but returns Either data or error instead
const get = <T>(url: string): Either<Error, T> => new Promise(async resolve => {
    try {
        return resolve(Right(await fetch(url)))
    } catch (error) {
        return resolve(Left(error))
    }
});

// either usage
either((error) => {
    console.error({ error })
}, (result) => {
    console.log({ result })
}, await get<string[]>('https://api'));

Keywords

FAQs

Package last updated on 05 Aug 2022

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