toBoolean

Converts value to a boolean. If value is an empty string, 'false' or '0', it will be converted to false, otherwise to true.

const sanitizationRules = {
  is_admin: 'boolean'
}

// or
const sanitizationRules = {
  is_admin: [
    rule('boolean')
  ]
}

For customized build, you can import this rule as follows.

import { toBoolean } from 'indicative/builds/validations'