Joik is a small store for Joi rules and schemas. The whole purpose is to avoid circular dependency
Rules are pure Joi objects that don't require any other code to be built.
const joik = Joi// Add a new rule to the storejoik// You can retrieve this rule later onconst rule = joik// Since it's a Joi object you can use it as you wishJoi
Schemas are complex pieces of logic that can reuse pre-stored rules and other schemas.
// Create a new schema just like a rule, but now you can use the store object// to retrieve other Joi objectsjoik// To build the schema just call the function again without the second paramconst schema = joik
Since build methods returns a Joi object you can easily compose complex schemas using Joi methods:
joik// And again just call schema to build itconst schema = joik
Copyright (c) 2017, Alan Hoffmeister email@example.com
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.