Skip to content

Instantly share code, notes, and snippets.

@ealush
Created February 11, 2018 22:23
Show Gist options
  • Select an option

  • Save ealush/e4d4f00c6f29212818eba15cbe0bc9cd to your computer and use it in GitHub Desktop.

Select an option

Save ealush/e4d4f00c6f29212818eba15cbe0bc9cd to your computer and use it in GitHub Desktop.
// 1: accepts a value
enforce(1)
// 2: returns an object
{
isNumber: // func,
largerThan: // func,
...
}
// 3: has the function aware of the initial value
enforce(1).largerThan(3) // = (number, initial) => number < initial
// 4: throw on false
throw new Error()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment