88 * A port of inflection-js to node.js module.
99 */
1010Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
11- exports . transform = exports . ordinalize = exports . foreignKey = exports . classify = exports . tableize = exports . demodulize = exports . titleize = exports . dasherize = exports . capitalize = exports . humanize = exports . underscore = exports . camelize = exports . inflect = exports . singularize = exports . pluralize = exports . indexOf = void 0 ;
11+ exports . transform = exports . ordinalize = exports . foreignKey = exports . classify = exports . tableize = exports . demodulize = exports . titleize = exports . dasherize = exports . capitalize = exports . humanize = exports . underscore = exports . camelize = exports . inflect = exports . singularize = exports . pluralize = void 0 ;
1212/**
1313 * @description This is a list of nouns that use the same form for both singular and plural.
1414 * This list should remain entirely in lower case to correctly match Strings.
@@ -565,7 +565,7 @@ function applyRules(str, rules, skip, override) {
565565 str = override ;
566566 }
567567 else {
568- const ignore = indexOf ( skip , str . toLowerCase ( ) ) > - 1 ;
568+ const ignore = skip . indexOf ( str . toLocaleLowerCase ( ) ) > - 1 ;
569569 if ( ! ignore ) {
570570 const j = rules . length ;
571571 for ( let i = 0 ; i < j ; i ++ ) {
@@ -581,34 +581,6 @@ function applyRules(str, rules, skip, override) {
581581 }
582582 return str ;
583583}
584- /**
585- * This lets us detect if an Array contains a given element.
586- * @param arr The subject array.
587- * @param item Object to locate in the Array.
588- * @param fromIndex Starts checking from this position in the Array.(optional)
589- * @param compareFunc Function used to compare Array item vs passed item.(optional)
590- * @returns Return index position in the Array of the passed item.
591- * @example
592- *
593- * const inflection = require( 'inflection' );
594- *
595- * inflection.indexOf([ 'hi','there' ], 'guys' ); // === -1
596- * inflection.indexOf([ 'hi','there' ], 'hi' ); // === 0
597- */
598- function indexOf ( arr , item , fromIndex , compareFunc ) {
599- if ( ! fromIndex ) {
600- fromIndex = - 1 ;
601- }
602- let index = - 1 ;
603- for ( let i = fromIndex ; i < arr . length ; i ++ ) {
604- if ( arr [ i ] === item || ( compareFunc && compareFunc ( arr [ i ] , item ) ) ) {
605- index = i ;
606- break ;
607- }
608- }
609- return index ;
610- }
611- exports . indexOf = indexOf ;
612584/**
613585 * This function adds pluralization support to every String object.
614586 * @param str The subject string.
@@ -816,7 +788,7 @@ function titleize(str) {
816788 d = strArr [ i ] . split ( '-' ) ;
817789 l = d . length ;
818790 for ( let k = 0 ; k < l ; k ++ ) {
819- if ( indexOf ( nonTitlecasedWords , d [ k ] . toLowerCase ( ) ) < 0 ) {
791+ if ( nonTitlecasedWords . indexOf ( d [ k ] . toLowerCase ( ) ) < 0 ) {
820792 d [ k ] = capitalize ( d [ k ] ) ;
821793 }
822794 }
0 commit comments