All Downloads are FREE. Search and download functionalities are using the official Maven repository.

node_modules.inflected.dist.umd.inflected.min.js Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.Inflector=e.Inflector||{})}(this,function(e){"use strict";function r(e){return"[object Function]"===z.call(e)}function n(e){return e.split("").map(function(e){return"(?:"+e.toUpperCase()+"|"+e.toLowerCase()+")"}).join("")}function i(e,r){for(var n=e.length-1;n>=0;n--)e[n]===r&&Array.prototype.splice.call(e,n,1)}function a(e,r){return Object.prototype.hasOwnProperty.call(e,r)}function t(e){e.plural(/$/,"s"),e.plural(/s$/i,"s"),e.plural(/^(ax|test)is$/i,"$1es"),e.plural(/(octop|vir)us$/i,"$1i"),e.plural(/(octop|vir)i$/i,"$1i"),e.plural(/(alias|status)$/i,"$1es"),e.plural(/(bu)s$/i,"$1ses"),e.plural(/(buffal|tomat)o$/i,"$1oes"),e.plural(/([ti])um$/i,"$1a"),e.plural(/([ti])a$/i,"$1a"),e.plural(/sis$/i,"ses"),e.plural(/(?:([^f])fe|([lr])f)$/i,"$1$2ves"),e.plural(/(hive)$/i,"$1s"),e.plural(/([^aeiouy]|qu)y$/i,"$1ies"),e.plural(/(x|ch|ss|sh)$/i,"$1es"),e.plural(/(matr|vert|ind)(?:ix|ex)$/i,"$1ices"),e.plural(/^(m|l)ouse$/i,"$1ice"),e.plural(/^(m|l)ice$/i,"$1ice"),e.plural(/^(ox)$/i,"$1en"),e.plural(/^(oxen)$/i,"$1"),e.plural(/(quiz)$/i,"$1zes"),e.singular(/s$/i,""),e.singular(/(ss)$/i,"$1"),e.singular(/(n)ews$/i,"$1ews"),e.singular(/([ti])a$/i,"$1um"),e.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i,"$1sis"),e.singular(/(^analy)(sis|ses)$/i,"$1sis"),e.singular(/([^f])ves$/i,"$1fe"),e.singular(/(hive)s$/i,"$1"),e.singular(/(tive)s$/i,"$1"),e.singular(/([lr])ves$/i,"$1f"),e.singular(/([^aeiouy]|qu)ies$/i,"$1y"),e.singular(/(s)eries$/i,"$1eries"),e.singular(/(m)ovies$/i,"$1ovie"),e.singular(/(x|ch|ss|sh)es$/i,"$1"),e.singular(/^(m|l)ice$/i,"$1ouse"),e.singular(/(bus)(es)?$/i,"$1"),e.singular(/(o)es$/i,"$1"),e.singular(/(shoe)s$/i,"$1"),e.singular(/(cris|test)(is|es)$/i,"$1is"),e.singular(/^(a)x[ie]s$/i,"$1xis"),e.singular(/(octop|vir)(us|i)$/i,"$1us"),e.singular(/(alias|status)(es)?$/i,"$1"),e.singular(/^(ox)en/i,"$1"),e.singular(/(vert|ind)ices$/i,"$1ex"),e.singular(/(matr)ices$/i,"$1ix"),e.singular(/(quiz)zes$/i,"$1"),e.singular(/(database)s$/i,"$1"),e.irregular("person","people"),e.irregular("man","men"),e.irregular("child","children"),e.irregular("sex","sexes"),e.irregular("move","moves"),e.irregular("zombie","zombies"),e.uncountable("equipment","information","rice","money","species","series","fish","sheep","jeans","police")}function s(e,n){if(r(e)&&(n=e,e=null),e=e||"en",!n)return L.getInstance(e);n(L.getInstance(e))}function u(e,r){var n,i,a,t=""+e;if(0===t.length)return t;var u=t.toLowerCase().match(/\b\w+$/);if(u&&s().uncountables.indexOf(u[0])>-1)return t;for(var o=0,l=r.length;o1&&void 0!==arguments[1]?arguments[1]:"en").plurals)}function l(e){return u(e,s(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en").singulars)}function c(e){var r=null===e||void 0===e?"":String(e);return r.charAt(0).toUpperCase()+r.slice(1)}function p(e,r){null!==r&&void 0!==r||(r=!0);var n=""+e;return n=r?n.replace(/^[a-z\d]*/,function(e){return s().acronyms[e]||c(e)}):n.replace(new RegExp("^(?:"+s().acronymRegex.source+"(?=\\b|[A-Z_])|\\w)"),function(e){return e.toLowerCase()}),n=n.replace(/(?:_|(\/))([a-z\d]*)/gi,function(e,r,n,i,a){return r||(r=""),""+r+(s().acronyms[n]||c(n))})}function $(e){var r=""+e;return r=r.replace(new RegExp("(?:([A-Za-z\\d])|^)("+s().acronymRegex.source+")(?=\\b|[^a-z])","g"),function(e,r,n){return(r||"")+(r?"_":"")+n.toLowerCase()}),r=r.replace(/([A-Z\d]+)([A-Z][a-z])/g,"$1_$2"),r=r.replace(/([a-z\d])([A-Z])/g,"$1_$2"),r=r.replace(/-/g,"_"),r.toLowerCase()}function g(e,r){var n=""+e,i=s().humans,a=void 0,t=void 0,u=void 0;r=r||{},null!==r.capitalize&&void 0!==r.capitalize||(r.capitalize=!0);for(var o=0,l=i.length;o-1){n=n.replace(t,u);break}return n=n.replace(/_id$/,""),n=n.replace(/_/g," "),n=n.replace(/([a-z\d]*)/gi,function(e){return s().acronyms[e]||e.toLowerCase()}),r.capitalize&&(n=n.replace(/^\w/,function(e){return e.toUpperCase()})),n}function f(e){return g($(e)).replace(/(^|[\s¿\/]+)([a-z])/g,function(e,r,n,i,a){return e.replace(n,n.toUpperCase())})}function h(e){return o($(e))}function v(e){return p(l(e.replace(/.*\./g,"")))}function m(e){return e.replace(/_/g,"-")}function y(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return $(e)+(r?"_id":"id")}function d(e){var r=Math.abs(Number(e)),n=r%100;if(11===n||12===n||13===n)return"th";switch(r%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}function w(e){return""+e+d(e)}function x(e,n){if(r(e)&&(n=e,e=null),e=e||"en",!n)return _.getInstance(e);n(_.getInstance(e))}function b(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.locale||"en",i=r.replacement||"?";return x(n).transliterate(e,i)}function C(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0===r.separator&&(r.separator="-"),null===r.separator&&(r.separator="");var n=b(e,r);if(n=n.replace(/[^a-z0-9\-_]+/gi,r.separator),r.separator.length){var i=new RegExp(r.separator);n=n.replace(new RegExp(i.source+"{2,}"),r.separator),n=n.replace(new RegExp("^"+i.source+"|"+i.source+"$","i"),"")}return n.toLowerCase()}var z=Object.prototype.toString,E=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},R=function(){function e(e,r){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"all";"all"===e?(this.plurals=[],this.singulars=[],this.uncountables=[],this.humans=[]):this[e]=[]}}]),e}(),A={en:t};for(var I in A)s(I,A[I]);var O={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","×":"x","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"Th","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Ċ":"C","ċ":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"D","đ":"d","Ē":"E","ē":"e","Ĕ":"E","ĕ":"e","Ė":"E","ė":"e","Ę":"E","ę":"e","Ě":"E","ě":"e","Ĝ":"G","ĝ":"g","Ğ":"G","ğ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ĥ":"H","ĥ":"h","Ħ":"H","ħ":"h","Ĩ":"I","ĩ":"i","Ī":"I","ī":"i","Ĭ":"I","ĭ":"i","Į":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","ĺ":"l","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ŀ":"L","ŀ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"'n","Ŋ":"NG","ŋ":"ng","Ō":"O","ō":"o","Ŏ":"O","ŏ":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ŗ":"R","ŗ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ŝ":"S","ŝ":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ŧ":"T","ŧ":"t","Ũ":"U","ũ":"u","Ū":"U","ū":"u","Ŭ":"U","ŭ":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z"},k={},_=function(){function e(){E(this,e),this.approximations={};for(var r in O)this.approximate(r,O[r])}return R(e,null,[{key:"getInstance",value:function(r){return k[r]=k[r]||new e,k[r]}}]),R(e,[{key:"approximate",value:function(e,r){this.approximations[e]=r}},{key:"transliterate",value:function(e,r){var n=this;return e.replace(/[^\u0000-\u007f]/g,function(e){return n.approximations[e]||r||"?"})}}]),e}();e.pluralize=o,e.singularize=l,e.camelize=p,e.underscore=$,e.humanize=g,e.titleize=f,e.tableize=h,e.classify=v,e.dasherize=m,e.foreignKey=y,e.ordinal=d,e.ordinalize=w,e.transliterate=b,e.parameterize=C,e.capitalize=c,e.inflections=s,e.transliterations=x,Object.defineProperty(e,"__esModule",{value:!0})});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy