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

bs-awesomize

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bs-awesomize

A ReasonML implementation of the Awesomize validation and data scrubbing library.

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
19
increased by533.33%
Maintainers
3
Weekly downloads
 
Created
Source

Build Status Coverage Status

bs-awesomize

A ReasonML implementation of the Awesomize library for data validation / scrubbing

Why?

We use Awesomize to ensure that data which comes into our system fits the proper shape and is within expected constraints. There are several other libraries which aim to handle this, however, translating them to ReasonML proved problematic. Also, the Awesomize library is asynchronous by default which allows much greater flexibility in validation / scrubbing code.

Status

This library can be considered production ready.

Installation

Inside of a BuckleScript project:

yarn add bs-awesomize

Then add bs-awesomize to your bs-dependencies in your bsconfig.json

{
  "bs-dependencies": [ "bs-awesomize" ]
}

Usage

In order to use awesomize you will want to provide a "schema" which consists of a map of fields to field definitions.

Field definition

type maybe = option(Js.Json.t);
type jsonMap = Belt.Map.String.t(maybe);

type definition = {
  read: Js.Dict.t(Js.Json.t) => Js.Promise.t(maybe),
  sanitize: option((maybe, jsonMap) => Js.Promise.t(maybe)),
  validate: list((maybe, jsonMap) => Js.Promise.t(option(string))),
  normalize: option((maybe, jsonMap) => Js.Promise.t(maybe)),
};

FAQs

Package last updated on 19 Aug 2020

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