0.3.0 • Published 5 years ago

@code.gov/cautious v0.3.0

Weekly downloads
6
License
CC0-1.0
Repository
github
Last release
5 years ago

alpha version

This code should not be used in production. It is prone to breaking changes.

cautious

Cautious Utility Functions in JavaScript

why?

We deal with a lot of dirty data. We have found ourselves rewriting a lot of the same null-checking and try-catching patterns because we can't guarantee that the data we are processing is clean. Instead of rewriting again and again, lets write just once some convience functions with null-checking and try-catching inside of them and use those throughout our tech stack.

when not to use this

Your data is clean and reliably sticks to a certain schema

examples

before

if (Array.isArray(languages) && language.length > 1) {
  console.log("languages are", languages)
}

after

if (some(languages)) {
  console.log("languages are", languages)
}