plugins/KebabPlugin.js

const KebabPlugin = {

  /**
   * @desc take in an array of methods, when called, set with kebabed name
   * @param  {Array<string>} methods
   * @return {ObjectChain} @chainable
   */
  extendKebab(methods) {
    const KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g
    function kebabCase(str) {
      return str.replace(KEBAB_REGEX, match => '-' + match.toLowerCase())
    }

    methods.forEach(method => {
      this[method] = arg => this.set(kebabCase(method), arg)
    })

    return this
  },
}

module.exports = KebabPlugin