busypeoples / spected

Validation library
MIT License
703 stars 32 forks source link

Description of functions #8

Open clintonyeb opened 7 years ago

clintonyeb commented 7 years ago

Please add descriptions to functions in the source code, to make it easy to read and understand.

Example:

/**
 *   Transforms an input element....
 * @param {Function} successFn callback function in case of valid input
 * @param {Function} failFn callback function in case of invalid input
 * @param {Array} input
 * @returns {*}
 */
const transform = (successFn: Function, failFn: Function, input: Array<any>): any => {
  const valid = all(equals(true), input)
  return valid ? successFn() : failFn(filter(a => a !== true, input))
}
busypeoples commented 7 years ago

Will also add a couple of examples to the docs.