JAVASCRIPT   699

underscore.js

Guest on 27th August 2021 01:31:33 AM

  1. define(['../lang/toString', './slugify', './unCamelCase'], function(toString, slugify, unCamelCase){
  2.     /**
  3.      * Replaces spaces with underscores, split camelCase text, remove non-word chars, remove accents and convert to lower case.
  4.      */
  5.     function underscore(str){
  6.         str = toString(str);
  7.         str = unCamelCase(str);
  8.         return slugify(str, "_");
  9.     }
  10.     return underscore;
  11. });

Raw Paste


Login or Register to edit or fork this paste. It's free.