1/** 2 * @author Valentin Alisch <[email protected]> 3 * @version 7.2 4 * 5 * Mdj: Helper: Text functions 6 */ 7var Mdj = Mdj || {}; 8Mdj.Helper = Mdj.Helper || {}; 9Mdj.Helper.Text = Mdj.Helper.Text || {}; 10 11 12 13 14 15 16/* ---------------------------------------- */ 17/* ------------------------- */ 18 19/** 20 * Sanitize title 21 * 22 * @since 0.9.4 23 * 24 * @return {string} 25 */ 26String.prototype.sanitize_title = function() { 27 let string = this.trim(); 28 string = string.replace( /^\s+|\s+$/g, '' ); 29 string = string.toLowerCase(); 30 31 const from = 'à áäâèéëêìÃïîòóöôùúüûñçÄÅ¡ÄÅžýúůÄťŷ/_,:;'; 32 const to = 'aaaaeeeeiiiioooouuuuncescrzyuudtn------'; 33 for ( let i = 0, l = from.length; i < l; i++ ) string = string.replace( new RegExp( from.charAt( i ), 'g' ), to.charAt( i ) ); 34 35 string = string 36 .replace( '.', '-' ) 37 .replace( /[^a-z0-9 -]/g, '' ) 38 .replace( /\s+/g, '-' ) 39 .replace( /-+/g, '-' ) 40 .replace( /\//g, '' ) 41 ; 42 43 44 45 /* > */ 46 return string; 47} 48 49 50 51/* ------------------------- */ 52 53/** 54 * Snake_Case string 55 * 56 * @since 0.9.4 57 * 58 * @param {string} string 59 * 60 * @return {string} 61 */ 62String.prototype.snakecase_title = function() { 63 let string = this.sanitize_title().replace( '_', '-' ); 64 let string__array = string.split( '-' ); 65 string__array = string__array.map( part => part.charAt(0).toUpperCase() + part.substring(1).toLowerCase() ); 66 string = string__array.join( '_' ); 67 68 69 70 /* > */ 71 return string; 72} 73 74String.prototype.snakecaseit = function() { 75 return this.snakecase_title(); 76}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.