UNPKG

obj-chain-core

Version:

fluent chaining for obj with dot-prop access

81 lines (56 loc) 2.9 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>plugins/KebabPlugin.js - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ObjChain.html">ObjChain</a><ul class='methods'><li data-type='method'><a href="ObjChain.html#.init">init</a></li><li data-type='method'><a href="ObjChain.html#escape">escape</a></li><li data-type='method'><a href="ObjChain.html#extend">extend</a></li><li data-type='method'><a href="ObjChain.html#has">has</a></li><li data-type='method'><a href="ObjChain.html#setIfNotEmpty">setIfNotEmpty</a></li><li data-type='method'><a href="ObjChain.html#toString">toString</a></li><li data-type='method'><a href="ObjChain.html#use">use</a></li><li data-type='method'><a href="ObjChain.html#val">val</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html"></a></li><li><a href="global.html#configPlugin">configPlugin</a></li><li><a href="global.html#flow">flow</a></li><li><a href="global.html#remove">remove</a></li><li><a href="global.html#set">set</a></li><li><a href="global.html#write">write</a></li></ul> </nav> <div id="main"> <h1 class="page-title">plugins/KebabPlugin.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>const KebabPlugin = { /** * @desc take in an array of methods, when called, set with kebabed name * @param {Array&lt;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 </code></pre> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri Apr 28 2017 01:03:22 GMT-0700 (PDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>