Getting Started
#
Installationcrocks
is available from npm
and is just a shell command away. All you need
to do is run the following to save it as a dependency in your current project
folder:
This will pull down crocks
into your project's node_modules
folder and can
be accessed by adding something like the following in the file that needs it:
#
Import only what's neededThere is a lot to this library, and as such it may not be desired to bring in
the whole thing when bundling for a library or frontend application. If
this is the case, the code is organized in a manner that groups all functions
that return or construct a given ADT into their respective folders. While
general purpose functions are spread across the following
folders: combinators
, helpers
, logic
, pointfree
and predicates
.
To access the types, just reference the folder like: crocks/Maybe
,
or crocks/Result
. If you want to access a function that constructs a given
type, reference it by name,
like: crocks/Maybe/safe
or crocks/Result/tryCatch
.
This organization helps ensure that you only include what you need.
#
Entire library (CommonJS)- Source
- Runkit
#
Entire library (JS Modules)- Source
- Runkit
#
Single entities (CommonJS)- Source
- Runkit
#
Single entities (JS Modules)- Source
- Runkit