JAVASCRIPT   678

unhyphenate.js

Guest on 27th August 2021 01:28:28 AM

  1. define(['../lang/toString'], function(toString){
  2.     /**
  3.      * Replaces hyphens with spaces. (only hyphens between word chars)
  4.      */
  5.     function unhyphenate(str){
  6.         str = toString(str);
  7.         return str.replace(/(\w)(-)(\w)/g, '$1 $3');
  8.     }
  9.     return unhyphenate;
  10. });

Raw Paste


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