{"version":3,"file":"voca.min.js","sources":["../src/helper/object/is_nil.js","../src/helper/boolean/coerce_to_boolean.js","../src/query/is_string.js","../src/helper/string/coerce_to_string.js","../src/case/capitalize.js","../src/case/lower_case.js","../src/helper/undefined/nil_default.js","../src/helper/string/to_string.js","../src/split/words.js","../src/case/camel_case.js","../src/case/decapitalize.js","../src/case/kebab_case.js","../src/case/snake_case.js","../src/case/upper_case.js","../src/case/swap_case.js","../src/case/title_case.js","../src/helper/number/clip_number.js","../src/helper/number/to_integer.js","../src/chop/truncate.js","../src/chop/char_at.js","../src/helper/string/surrogate_pair.js","../src/helper/number/coerce_to_number.js","../src/helper/number/nan_default.js","../src/chop/code_point_at.js","../src/chop/first.js","../src/chop/grapheme_at.js","../src/chop/last.js","../src/chop/prune.js","../src/chop/slice.js","../src/chop/substr.js","../src/chop/substring.js","../src/count/count.js","../src/count/count_graphemes.js","../src/count/count_substrings.js","../src/count/count_where.js","../src/count/count_words.js","../src/helper/format/replacement/index.js","../src/manipulate/repeat.js","../src/helper/string/build_padding.js","../src/manipulate/pad_left.js","../src/manipulate/pad_right.js","../src/helper/format/align_and_pad.js","../src/helper/format/type_format/add_sign_to_formatted_number.js","../src/helper/format/type_format/float.js","../src/helper/format/type_format/integer_base.js","../src/helper/format/type_format/integer_decimal.js","../src/helper/format/type_format/string.js","../src/helper/format/replacement/compute.js","../src/helper/format/conversion_specification.js","../src/helper/format/replacement/validate.js","../src/helper/format/replacement/match.js","../src/format/sprintf.js","../src/format/vprintf.js","../src/escape/escape_html.js","../src/escape/escape_reg_exp.js","../src/escape/unescape_html.js","../src/index/index_of.js","../src/index/last_index_of.js","../src/index/search.js","../src/manipulate/insert.js","../src/helper/string/diacritics_map.js","../src/manipulate/latinise.js","../src/manipulate/pad.js","../src/manipulate/replace.js","../src/helper/reg_exp/get_reg_exp_flags.js","../src/query/includes.js","../src/helper/reg_exp/append_flag_to_reg_exp.js","../src/manipulate/replace_all.js","../src/manipulate/reverse.js","../src/manipulate/reverse_grapheme.js","../src/manipulate/slugify.js","../src/manipulate/splice.js","../src/manipulate/tr.js","../src/manipulate/trim_left.js","../src/manipulate/trim_right.js","../src/manipulate/trim.js","../src/manipulate/word_wrap.js","../src/query/ends_with.js","../src/query/is_alpha.js","../src/query/is_alpha_digit.js","../src/query/is_blank.js","../src/query/is_digit.js","../src/query/is_empty.js","../src/query/is_lower_case.js","../src/query/is_numeric.js","../src/query/is_upper_case.js","../src/query/matches.js","../src/query/starts_with.js","../src/split/chars.js","../src/split/code_points.js","../src/split/graphemes.js","../src/split/split.js","../src/strip/strip_bom.js","../src/helper/string/has_substring_at_index.js","../src/helper/strip/parse_tag_list.js","../src/helper/strip/parse_tag_name.js","../src/strip/strip_tags.js","../src/util/no_conflict.js","../src/chain/wrapper.js","../src/chain/chain.js","../src/index.js","../src/helper/reg_exp/const.js","../src/helper/reg_exp/const_extended.js","../src/helper/number/const.js","../src/helper/format/const.js","../src/helper/object/get_global.js","../src/util/version.js"],"sourcesContent":["/**\n * Checks if `value` is `null` or `undefined`\n *\n * @ignore\n * @function isNil\n * @param {*} value The object to check\n * @return {boolean} Returns `true` is `value` is `undefined` or `null`, `false` otherwise\n */\nexport default function isNil(value) {\n return value === undefined || value === null;\n}","import isNil from 'helper/object/is_nil';\n\n/**\n * Converts the `value` to a boolean. If `value` is `undefined` or `null`, returns `defaultValue`.\n *\n * @ignore\n * @function toBoolean\n * @param {*} value The value to convert.\n * @param {boolean} [defaultValue=false] The default value.\n * @return {boolean} Returns the coercion to boolean.\n */\nexport default function coerceToBoolean(value, defaultValue = false) {\n if (isNil(value)) {\n return defaultValue;\n }\n return Boolean(value);\n}","/**\n * Checks whether `subject` is a string primitive type.\n *\n * @function isString\n * @static\n * @since 1.0.0\n * @memberOf Query\n * @param {string} subject The value to verify.\n * @return {boolean} Returns `true` if `subject` is string primitive type or `false` otherwise.\n * @example\n * v.isString('vacation');\n * // => true\n *\n * v.isString(560);\n * // => false\n */\nexport default function isString(subject) {\n return typeof subject === 'string';\n}","import isNil from 'helper/object/is_nil';\nimport isString from 'query/is_string';\n\n/**\n * Get the string representation of the `value`.\n * Converts the `value` to string.\n * If `value` is `null` or `undefined`, return `defaultValue`.\n *\n * @ignore\n * @function toString\n * @param {*} value The value to convert.\n * @param {*} [defaultValue=''] The default value to return.\n * @return {string|null} Returns the string representation of `value`. Returns `defaultValue` if `value` is\n * `null` or `undefined`.\n */\nexport default function coerceToString(value, defaultValue = '') {\n if (isNil(value)) {\n return defaultValue;\n }\n if (isString(value)) {\n return value;\n }\n return String(value);\n}","import coerceToBoolean from 'helper/boolean/coerce_to_boolean';\nimport coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Converts the first character of `subject` to upper case. If `restToLower` is `true`, convert the rest of\n * `subject` to lower case.\n *\n * @function capitalize\n * @static\n * @since 1.0.0\n * @memberOf Case\n * @param {string} [subject=''] The string to capitalize.\n * @param {boolean} [restToLower=false] Convert the rest of `subject` to lower case.\n * @return {string} Returns the capitalized string.\n * @example\n * v.capitalize('apple');\n * // => 'Apple'\n *\n * v.capitalize('aPPle', true);\n * // => 'Apple'\n */\nexport default function capitalize(subject, restToLower) {\n let subjectString = coerceToString(subject);\n const restToLowerCaseBoolean = coerceToBoolean(restToLower);\n if (subjectString === '') {\n return '';\n }\n if (restToLowerCaseBoolean) {\n subjectString = subjectString.toLowerCase();\n }\n return subjectString.substr(0, 1).toUpperCase() + subjectString.substr(1);\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Converts the `subject` to lower case.\n *\n * @function lowerCase\n * @static\n * @since 1.0.0\n * @memberOf Case\n * @param {string} [subject=''] The string to convert to lower case.\n * @return {string} Returns the lower case string.\n * @example\n * v.lowerCase('Green');\n * // => 'green'\n *\n * v.lowerCase('BLUE');\n * // => 'blue'\n */\nexport default function lowerCase(subject) {\n const subjectString = coerceToString(subject, '');\n return subjectString.toLowerCase();\n}\n","/**\n * Verifies if `value` is `undefined` or `null` and returns `defaultValue`. In other case returns `value`.\n *\n * @ignore\n * @function nilDefault\n * @param {*} value The value to verify.\n * @param {*} defaultValue The default value.\n * @return {*} Returns `defaultValue` if `value` is `undefined` or `null`, otherwise `defaultValue`.\n */\nexport default function nilDefault(value, defaultValue) {\n return value == null ? defaultValue : value;\n}","import isNil from 'helper/object/is_nil';\nimport isString from 'query/is_string';\n\n/**\n * Get the string representation of the `value`.\n * Converts the `value` to string.\n *\n * @ignore\n * @function toString\n * @param {*} value The value to convert.\n * @return {string|null} Returns the string representation of `value`.\n */\nexport default function toString(value) {\n if (isNil(value)) {\n return null;\n }\n if (isString(value)) {\n return value;\n }\n return String(value);\n}","import { REGEXP_EXTENDED_ASCII, REGEXP_LATIN_WORD, REGEXP_WORD } from 'helper/reg_exp/const_extended';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport nilDefault from 'helper/undefined/nil_default';\nimport toString from 'helper/string/to_string';\n\n/**\n * Splits `subject` into an array of words.\n *\n * @function words\n * @static\n * @since 1.0.0\n * @memberOf Split\n * @param {string} [subject=''] The string to split into words.\n * @param {string|RegExp} [pattern] The pattern to watch words. If `pattern` is not RegExp, it is transformed to `new RegExp(pattern, flags)`.\n * @param {string} [flags=''] The regular expression flags. Applies when `pattern` is string type.\n * @return {Array} Returns the array of words.\n * @example\n * v.words('gravity can cross dimensions');\n * // => ['gravity', 'can', 'cross', 'dimensions']\n *\n * v.words('GravityCanCrossDimensions');\n * // => ['Gravity', 'Can', 'Cross', 'Dimensions']\n *\n * v.words('Gravity - can cross dimensions!');\n * // => ['Gravity', 'can', 'cross', 'dimensions']\n *\n * v.words('Earth gravity', /[^\\s]+/g);\n * // => ['Earth', 'gravity']\n */\nexport default function words(subject, pattern, flags) {\n const subjectString = coerceToString(subject);\n let patternRegExp;\n if (isNil(pattern)) {\n patternRegExp = REGEXP_EXTENDED_ASCII.test(subjectString) ? REGEXP_LATIN_WORD : REGEXP_WORD;\n } else if (pattern instanceof RegExp) {\n patternRegExp = pattern;\n } else {\n const flagsString = toString(nilDefault(flags, ''));\n patternRegExp = new RegExp(toString(pattern), flagsString);\n }\n return nilDefault(subjectString.match(patternRegExp), []);\n}","import capitalize from 'case/capitalize';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport lowerCase from 'case/lower_case';\nimport words from 'split/words';\n\n/**\n * Transforms the `word` into camel case chunk.\n *\n * @param {string} word The word string\n * @param {number} index The index of the word in phrase.\n * @return {string} The transformed word.\n * @ignore\n */\nfunction wordToCamel(word, index) {\n return index === 0 ? lowerCase(word) : capitalize(word, true);\n}\n\n/**\n * Converts the `subject` to camel case.\n *\n * @function camelCase\n * @static\n * @since 1.0.0\n * @memberOf Case\n * @param {string} [subject=''] The string to convert to camel case.\n * @return {string} The camel case string.\n * @example\n * v.camelCase('bird flight');\n * // => 'birdFlight'\n *\n * v.camelCase('BirdFlight');\n * // => 'birdFlight'\n *\n * v.camelCase('-BIRD-FLIGHT-');\n * // => 'birdFlight'\n */\nexport default function camelCase(subject) {\n const subjectString = coerceToString(subject);\n if (subjectString === '') {\n return '';\n }\n return words(subjectString).map(wordToCamel).join('');\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Converts the first character of `subject` to lower case.\n *\n * @function decapitalize\n * @static\n * @since 1.0.0\n * @memberOf Case\n * @param {string} [subject=''] The string to decapitalize.\n * @return {string} Returns the decapitalized string.\n * @example\n * v.decapitalize('Sun');\n * // => 'sun'\n *\n * v.decapitalize('moon');\n * // => 'moon'\n */\nexport default function decapitalize(subject) {\n const subjectString = coerceToString(subject);\n if (subjectString === '') {\n return '';\n }\n return subjectString.substr(0, 1).toLowerCase() + subjectString.substr(1);\n}","import coerceToString from 'helper/string/coerce_to_string';\nimport lowerCase from 'case/lower_case';\nimport words from 'split/words';\n\n/**\n * Converts the `subject` to kebab case,\n * also called spinal case or lisp case.\n *\n * @function kebabCase\n * @static\n * @since 1.0.0\n * @memberOf Case\n * @param {string} [subject=''] The string to convert to kebab case.\n * @return {string} Returns the kebab case string.\n * @example\n * v.kebabCase('goodbye blue sky');\n * // => 'goodbye-blue-sky'\n *\n * v.kebabCase('GoodbyeBlueSky');\n * // => 'goodbye-blue-sky'\n *\n * v.kebabCase('-Goodbye-Blue-Sky-');\n * // => 'goodbye-blue-sky'\n */\nexport default function kebabCase(subject) {\n const subjectString = coerceToString(subject);\n if (subjectString === '') {\n return '';\n }\n return words(subjectString).map(lowerCase).join('-');\n}","import coerceToString from 'helper/string/coerce_to_string';\nimport lowerCase from 'case/lower_case';\nimport words from 'split/words';\n\n/**\n * Converts the `subject` to snake case.\n *\n * @function snakeCase\n * @static\n * @since 1.0.0\n * @memberOf Case\n * @param {string} [subject=''] The string to convert to snake case.\n * @return {string} Returns the snake case string.\n * @example\n * v.snakeCase('learning to fly');\n * // => 'learning_to_fly'\n *\n * v.snakeCase('LearningToFly');\n * // => 'learning_to_fly'\n *\n * v.snakeCase('-Learning-To-Fly-');\n * // => 'learning_to_fly'\n */\nexport default function snakeCase(subject) {\n const subjectString = coerceToString(subject);\n if (subjectString === '') {\n return '';\n }\n return words(subjectString).map(lowerCase).join('_');\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Converts the `subject` to upper case.\n *\n * @function upperCase\n * @static\n * @since 1.0.0\n * @memberOf Case\n * @param {string} [subject=''] The string to convert to upper case.\n * @return {string} Returns the upper case string.\n * @example\n * v.upperCase('school');\n * // => 'SCHOOL'\n */\nexport default function upperCase(subject) {\n const subjectString = coerceToString(subject);\n return subjectString.toUpperCase();\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Converts the uppercase alpha caracters of `subject` to lowercase and lowercase \n * characters to uppercase.\n *\n * @function swapCase\n * @static\n * @since 1.3.0\n * @memberOf Case\n * @param {string} [subject=''] The string to swap the case.\n * @return {string} Returns the converted string.\n * @example\n * v.swapCase('League of Shadows');\n * // => 'lEAGUE OF sHADOWS'\n *\n * v.swapCase('2 Bees');\n * // => '2 bEES'\n */\nexport default function swapCase(subject) {\n const subjectString = coerceToString(subject);\n return subjectString.split('').reduce(swapAndConcat, '');\n}\n\nfunction swapAndConcat(swapped, character) {\n const lowerCase = character.toLowerCase();\n const upperCase = character.toUpperCase();\n return swapped + (character === lowerCase ? upperCase : lowerCase);\n}","import { REGEXP_EXTENDED_ASCII, REGEXP_LATIN_WORD, REGEXP_WORD } from 'helper/reg_exp/const_extended';\nimport capitalize from 'case/capitalize';\nimport coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Converts the subject to title case.\n *\n * @function titleCase\n * @static\n * @since 1.4.0\n * @memberOf Case\n * @param {string} [subject=''] The string to convert to title case.\n * @param {Array} [noSplit] Do not split words at the specified characters.\n * @return {string} Returns the title case string.\n * @example\n * v.titleCase('learning to fly');\n * // => 'Learning To Fly'\n *\n * v.titleCase('jean-luc is good-looking', ['-']);\n * // => 'Jean-luc Is Good-looking'\n */\nexport default function titleCase(subject, noSplit) {\n const subjectString = coerceToString(subject);\n const noSplitArray = Array.isArray(noSplit) ? noSplit : [];\n const wordsRegExp = REGEXP_EXTENDED_ASCII.test(subjectString) ? REGEXP_LATIN_WORD : REGEXP_WORD;\n return subjectString.replace(wordsRegExp, function(word, index) {\n const isNoSplit = index > 0 && noSplitArray.indexOf(subjectString[index - 1]) >= 0;\n return isNoSplit ? word.toLowerCase() : capitalize(word, true);\n });\n}","/**\n * Clip the number to interval `downLimit` to `upLimit`.\n *\n * @ignore\n * @function clipNumber\n * @param {number} value The number to clip\n * @param {number} downLimit The down limit\n * @param {number} upLimit The upper limit\n * @return {number} The clipped number\n */\nexport default function clipNumber(value, downLimit, upLimit) {\n if (value <= downLimit) {\n return downLimit;\n }\n if (value >= upLimit) {\n return upLimit;\n }\n return value;\n}","import { MAX_SAFE_INTEGER } from 'helper/number/const';\n\n/**\n * Transforms `value` to an integer.\n *\n * @ignore\n * @function toInteger\n * @param {number} value The number to transform.\n * @returns {number} Returns the transformed integer.\n */\nexport default function toInteger(value) {\n if (value === Infinity) {\n return MAX_SAFE_INTEGER;\n }\n if (value === -Infinity) {\n return - MAX_SAFE_INTEGER;\n }\n return ~~value;\n}","import clipNumber from 'helper/number/clip_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport { MAX_SAFE_INTEGER } from 'helper/number/const';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Truncates `subject` to a new `length`.\n *\n * @function truncate\n * @static\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to truncate.\n * @param {int} length The length to truncate the string.\n * @param {string} [end='...'] The string to be added at the end.\n * @return {string} Returns the truncated string.\n * @example\n * v.truncate('Once upon a time', 7);\n * // => 'Once...'\n *\n * v.truncate('Good day, Little Red Riding Hood', 14, ' (...)');\n * // => 'Good day (...)'\n *\n * v.truncate('Once upon', 10);\n * // => 'Once upon'\n */\nexport default function truncate(subject, length, end) {\n const subjectString = coerceToString(subject);\n const lengthInt = isNil(length) ? subjectString.length : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);\n const endString = coerceToString(end, '...');\n if (lengthInt >= subjectString.length) {\n return subjectString;\n }\n return subjectString.substr(0, length - endString.length) + endString;\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Access a character from `subject` at specified `position`.\n *\n * @function charAt\n * @static\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to extract from.\n * @param {numbers} position The position to get the character.\n * @return {string} Returns the character at specified position.\n * @example\n * v.charAt('helicopter', 0);\n * // => 'h'\n *\n * v.charAt('helicopter', 1);\n * // => 'e'\n */\nexport default function charAt(subject, position) {\n const subjectString = coerceToString(subject);\n return subjectString.charAt(position);\n}","const HIGH_SURROGATE_START = 0xD800;\nconst HIGH_SURROGATE_END = 0xDBFF;\nconst LOW_SURROGATE_START = 0xDC00;\nconst LOW_SURROGATE_END = 0xDFFF;\n\n/**\n * Checks if `codePoint` is a high-surrogate number from range 0xD800 to 0xDBFF.\n *\n * @ignore\n * @param {number} codePoint The code point number to be verified\n * @return {boolean} Returns a boolean whether `codePoint` is a high-surrogate number.\n */\nexport function isHighSurrogate(codePoint) {\n return codePoint >= HIGH_SURROGATE_START && codePoint <= HIGH_SURROGATE_END;\n}\n\n/**\n * Checks if `codePoint` is a low-surrogate number from range 0xDC00 to 0xDFFF.\n *\n * @ignore\n * @param {number} codePoint The code point number to be verified\n * @return {boolean} Returns a boolean whether `codePoint` is a low-surrogate number.\n */\nexport function isLowSurrogate(codePoint) {\n return codePoint >= LOW_SURROGATE_START && codePoint <= LOW_SURROGATE_END;\n}\n\n/**\n * Get the astral code point number based on surrogate pair numbers.\n *\n * @ignore\n * @param {number} highSurrogate The high-surrogate code point number.\n * @param {number} lowSurrogate The low-surrogate code point number.\n * @return {number} Returns the astral symbol number.\n */\nexport function getAstralNumberFromSurrogatePair(highSurrogate, lowSurrogate) {\n return (highSurrogate - HIGH_SURROGATE_START) * 0x400 + lowSurrogate - LOW_SURROGATE_START + 0x10000;\n}","import isNil from 'helper/object/is_nil';\n\n/**\n * Get the number representation of the `value`.\n * Converts the `value` to number.\n * If `value` is `null` or `undefined`, return `defaultValue`.\n *\n * @ignore\n * @function toString\n * @param {*} value The value to convert.\n * @param {*} [defaultValue=''] The default value to return.\n * @return {number|null} Returns the number representation of `value`. Returns `defaultValue` if `value` is\n * `null` or `undefined`.\n */\nexport default function coerceToNumber(value, defaultValue = 0) {\n if (isNil(value)) {\n return defaultValue;\n }\n if (typeof value === 'number') {\n return value;\n }\n return Number(value);\n}","/**\n * If `value` is `NaN`, return `defaultValue`. In other case returns `value`.\n *\n * @ignore\n * @function nanDefault\n * @param {*} value The value to verify.\n * @param {*} defaultValue The default value.\n * @return {*} Returns `defaultValue` if `value` is `NaN`, otherwise `defaultValue`.\n */\nexport default function nanDefault(value, defaultValue) {\n return value !== value ? defaultValue : value;\n}","import { getAstralNumberFromSurrogatePair, isHighSurrogate, isLowSurrogate } from 'helper/string/surrogate_pair';\nimport coerceToNumber from 'helper/number/coerce_to_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport nanDefault from 'helper/number/nan_default';\n\n/**\n * Get the Unicode code point value of the character at `position`.
\n * If a valid UTF-16 \n * surrogate pair starts at `position`, the\n * astral code point\n * value at `position` is returned.\n *\n * @function codePointAt\n * @static\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to extract from.\n * @param {number} position The position to get the code point number.\n * @return {number} Returns a non-negative number less than or equal to `0x10FFFF`.\n * @example\n * v.codePointAt('rain', 1);\n * // => 97, or 0x0061\n *\n * v.codePointAt('\\uD83D\\uDE00 is smile', 0); // or '😀 is smile'\n * // => 128512, or 0x1F600\n */\nexport default function codePointAt(subject, position) {\n const subjectString = coerceToString(subject);\n const subjectStringLength = subjectString.length;\n let positionNumber = coerceToNumber(position);\n positionNumber = nanDefault(positionNumber, 0);\n if (positionNumber < 0 || positionNumber >= subjectStringLength) {\n return undefined;\n }\n const firstCodePoint = subjectString.charCodeAt(positionNumber);\n let secondCodePoint;\n if (isHighSurrogate(firstCodePoint) && subjectStringLength > positionNumber + 1) {\n secondCodePoint = subjectString.charCodeAt(positionNumber + 1);\n if (isLowSurrogate(secondCodePoint)) {\n return getAstralNumberFromSurrogatePair(firstCodePoint, secondCodePoint);\n }\n }\n return firstCodePoint;\n}","import clipNumber from 'helper/number/clip_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport { MAX_SAFE_INTEGER } from 'helper/number/const';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Extracts the first `length` characters from `subject`.\n *\n * @function first\n * @static\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to extract from.\n * @param {int} [length=1] The number of characters to extract.\n * @return {string} Returns the first characters string.\n * @example\n * v.first('helicopter');\n * // => 'h'\n *\n * v.first('vehicle', 2);\n * // => 've'\n *\n * v.first('car', 5);\n * // => 'car'\n */\nexport default function first(subject, length) {\n const subjectString = coerceToString(subject);\n const lengthInt = isNil(length) ? 1 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);\n if (subjectString.length <= lengthInt) {\n return subjectString;\n }\n return subjectString.substr(0, lengthInt);\n}","import coerceToNumber from 'helper/number/coerce_to_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport nanDefault from 'helper/number/nan_default';\nimport { REGEXP_UNICODE_CHARACTER } from 'helper/reg_exp/const';\n\n/**\n * Get a grapheme from `subject` at specified `position` taking care of\n * surrogate pairs and\n * combining marks.\n *\n * @function graphemeAt\n * @static\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to extract from.\n * @param {number} position The position to get the grapheme.\n * @return {string} Returns the grapheme at specified position.\n * @example\n * v.graphemeAt('\\uD835\\uDC00\\uD835\\uDC01', 0); // or '𝐀𝐁'\n * // => 'A'\n *\n * v.graphemeAt('cafe\\u0301', 3); // or 'café'\n * // => 'é'\n */\nexport default function graphemeAt(subject, position) {\n const subjectString = coerceToString(subject);\n let positionNumber = coerceToNumber(position);\n let graphemeMatch;\n let graphemeMatchIndex = 0;\n positionNumber = nanDefault(positionNumber, 0);\n while ((graphemeMatch = REGEXP_UNICODE_CHARACTER.exec(subjectString)) !== null) {\n if (graphemeMatchIndex === positionNumber) {\n REGEXP_UNICODE_CHARACTER.lastIndex = 0;\n return graphemeMatch[0];\n }\n graphemeMatchIndex++;\n }\n return '';\n}","import clipNumber from 'helper/number/clip_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport { MAX_SAFE_INTEGER } from 'helper/number/const';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Extracts the last `length` characters from `subject`.\n *\n * @function last\n * @static\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to extract from.\n * @param {int} [length=1] The number of characters to extract.\n * @return {string} Returns the last characters string.\n * @example\n * v.last('helicopter');\n * // => 'r'\n *\n * v.last('vehicle', 2);\n * // => 'le'\n *\n * v.last('car', 5);\n * // => 'car'\n */\nexport default function last(subject, length) {\n const subjectString = coerceToString(subject);\n const lengthInt = isNil(length) ? 1 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);\n if (subjectString.length <= lengthInt) {\n return subjectString;\n }\n return subjectString.substr(subjectString.length - lengthInt, lengthInt);\n}","import { REGEXP_EXTENDED_ASCII, REGEXP_LATIN_WORD, REGEXP_WORD } from 'helper/reg_exp/const_extended';\nimport clipNumber from 'helper/number/clip_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport { MAX_SAFE_INTEGER } from 'helper/number/const';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Truncates `subject` to a new `length` and does not break the words. Guarantees that the truncated string is no longer\n * than `length`.\n *\n * @static\n * @function prune\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to prune.\n * @param {int} length The length to prune the string.\n * @param {string} [end='...'] The string to be added at the end.\n * @return {string} Returns the pruned string.\n * @example\n * v.prune('Once upon a time', 7);\n * // => 'Once...'\n *\n * v.prune('Good day, Little Red Riding Hood', 16, ' (more)');\n * // => 'Good day (more)'\n *\n * v.prune('Once upon', 10);\n * // => 'Once upon'\n */\nexport default function prune(subject, length, end) {\n const subjectString = coerceToString(subject);\n const lengthInt = isNil(length) ? subjectString.length : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);\n const endString = coerceToString(end, '...');\n if (lengthInt >= subjectString.length) {\n return subjectString;\n }\n const pattern = REGEXP_EXTENDED_ASCII.test(subjectString) ? REGEXP_LATIN_WORD : REGEXP_WORD;\n let truncatedLength = 0;\n subjectString.replace(pattern, function(word, offset) {\n const wordInsertLength = offset + word.length;\n if (wordInsertLength <= lengthInt - endString.length) {\n truncatedLength = wordInsertLength;\n }\n });\n return subjectString.substr(0, truncatedLength) + endString;\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Extracts from `subject` a string from `start` position up to `end` position. The character at `end` position is not\n * included.\n *\n * @function slice\n * @static\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to extract from.\n * @param {number} start The position to start extraction. If negative use `subject.length + start`.\n * @param {number} [end=subject.length] The position to end extraction. If negative use `subject.length + end`.\n * @return {string} Returns the extracted string.\n * @note Uses native `String.prototype.slice()`\n * @example\n * v.slice('miami', 1);\n * // => 'iami'\n *\n * v.slice('florida', -4);\n * // => 'rida'\n *\n * v.slice('florida', 1, 4);\n * // => \"lor\"\n */\nexport default function slice(subject, start, end) {\n return coerceToString(subject).slice(start, end);\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Extracts from `subject` a string from `start` position a number of `length` characters.\n *\n * @function substr\n * @static\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to extract from.\n * @param {number} start The position to start extraction.\n * @param {number} [length=subject.endOfString] The number of characters to extract. If omitted, extract to the end of `subject`.\n * @return {string} Returns the extracted string.\n * @note Uses native `String.prototype.substr()`\n * @example\n * v.substr('infinite loop', 9);\n * // => 'loop'\n *\n * v.substr('dreams', 2, 2);\n * // => 'ea'\n */\nexport default function substr(subject, start, length) {\n return coerceToString(subject).substr(start, length);\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Extracts from `subject` a string from `start` position up to `end` position. The character at `end` position is not\n * included.\n *\n * @function substring\n * @static\n * @since 1.0.0\n * @memberOf Chop\n * @param {string} [subject=''] The string to extract from.\n * @param {number} start The position to start extraction.\n * @param {number} [end=subject.length] The position to end extraction.\n * @return {string} Returns the extracted string.\n * @note Uses native `String.prototype.substring()`\n * @example\n * v.substring('beach', 1);\n * // => 'each'\n *\n * v.substring('ocean', 1, 3);\n * // => 'ea'\n */\nexport default function substring(subject, start, end) {\n return coerceToString(subject).substring(start, end);\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Counts the characters in `subject`.
\n *\n * @function count\n * @static\n * @since 1.0.0\n * @memberOf Count\n * @param {string} [subject=''] The string to count characters.\n * @return {number} Returns the number of characters in `subject`.\n * @example\n * v.count('rain');\n * // => 4\n */\nexport default function count(subject) {\n return coerceToString(subject).length;\n}","import { REGEXP_COMBINING_MARKS, REGEXP_SURROGATE_PAIRS } from 'helper/reg_exp/const';\nimport coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Counts the graphemes in `subject` taking care of\n * surrogate pairs and\n * combining marks.\n *\n * @function countGraphemes\n * @static\n * @since 1.0.0\n * @memberOf Count\n * @param {string} [subject=''] The string to count graphemes.\n * @return {number} Returns the number of graphemes in `subject`.\n * @example\n * v.countGraphemes('cafe\\u0301'); // or 'café'\n * // => 4\n *\n * v.countGraphemes('\\uD835\\uDC00\\uD835\\uDC01'); // or '𝐀𝐁'\n * // => 2\n *\n * v.countGraphemes('rain');\n * // => 4\n */\nexport default function countGrapheme(subject) {\n return coerceToString(subject)\n .replace(REGEXP_COMBINING_MARKS, '*')\n .replace(REGEXP_SURROGATE_PAIRS, '*')\n .length;\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Counts the number of `substring` appearances in `subject`.\n *\n * @function countSubstrings\n * @static\n * @since 1.0.0\n * @memberOf Count\n * @param {string} [subject=''] The string where to count.\n * @param {string} substring The substring to be counted.\n * @return {number} Returns the number of `substring` appearances.\n * @example\n * v.countSubstrings('bad boys, bad boys whatcha gonna do?', 'boys');\n * // => 2\n *\n * v.countSubstrings('every dog has its day', 'cat');\n * // => 0\n */\nexport default function countSubstrings(subject, substring) {\n const subjectString = coerceToString(subject);\n const substringString = coerceToString(substring);\n const substringLength = substringString.length;\n let count = 0;\n let matchIndex = 0;\n if (subjectString === '' || substringString === '') {\n return count;\n }\n do {\n matchIndex = subjectString.indexOf(substringString, matchIndex);\n if (matchIndex !== -1) {\n count++;\n matchIndex += substringLength;\n }\n } while (matchIndex !== -1);\n return count;\n}","import coerceToString from 'helper/string/coerce_to_string';\n\nconst reduce = Array.prototype.reduce;\n\n/**\n * Counts the characters in `subject` for which `predicate` returns truthy.\n *\n * @function countWhere\n * @static\n * @since 1.0.0\n * @memberOf Count\n * @param {string} [subject=''] The string to count characters.\n * @param {Function} predicate The predicate function invoked on each character with parameters `(character, index, string)`.\n * @param {Object} [context] The context to invoke the `predicate`.\n * @return {number} Returns the number of characters for which `predicate` returns truthy.\n * @example\n * v.countWhere('hola!', v.isAlpha);\n * // => 4\n *\n * v.countWhere('2022', function(character, index, str) {\n * return character === '2';\n * });\n * // => 3\n */\nexport default function countWhere(subject, predicate, context) {\n const subjectString = coerceToString(subject);\n if (subjectString === '' || typeof predicate !== 'function') {\n return 0;\n }\n const predicateWithContext = predicate.bind(context);\n return reduce.call(subjectString, function(countTruthy, character, index) {\n return predicateWithContext(character, index, subjectString) ? countTruthy + 1 : countTruthy;\n }, 0);\n}","import words from 'split/words';\n\n/**\n * Counts the number of words in `subject`.\n *\n * @function countWords\n * @static\n * @since 1.0.0\n * @memberOf Count\n * @param {string} [subject=''] The string to split into words.\n * @param {string|RegExp} [pattern] The pattern to watch words. If `pattern` is not RegExp, it is transformed to `new RegExp(pattern, flags)`.\n * @param {string} [flags=''] The regular expression flags. Applies when `pattern` is string type.\n * @return {number} Returns the number of words.\n * @example\n * v.countWords('gravity can cross dimensions');\n * // => 4\n *\n * v.countWords('GravityCanCrossDimensions');\n * // => 4\n *\n * v.countWords('Gravity - can cross dimensions!');\n * // => 4\n *\n * v.words('Earth gravity', /[^\\s]+/g);\n * // => 2\n */\nexport default function countWords(subject, pattern, flags) {\n return words(subject, pattern, flags).length;\n}","import isNil from 'helper/object/is_nil';\n\n/**\n * The current index.\n *\n * @ignore\n * @name ReplacementIndex#index\n * @type {number}\n * @return {ReplacementIndex} ReplacementIndex instance.\n */\nfunction ReplacementIndex() {\n this.index = 0;\n}\n\n/**\n * Increment the current index.\n *\n * @ignore\n * @return {undefined}\n */\nReplacementIndex.prototype.increment = function() {\n this.index++;\n};\n\n/**\n * Increment the current index by position.\n *\n * @ignore\n * @param {number} [position] The replacement position.\n * @return {undefined}\n */\nReplacementIndex.prototype.incrementOnEmptyPosition = function(position) {\n if (isNil(position)) {\n this.increment();\n }\n};\n\n/**\n * Get the replacement index by position.\n *\n * @ignore\n * @param {number} [position] The replacement position.\n * @return {number} The replacement index.\n */\nReplacementIndex.prototype.getIndexByPosition = function(position) {\n return isNil(position) ? this.index : position - 1;\n};\n\nexport default ReplacementIndex;","import clipNumber from 'helper/number/clip_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport { MAX_SAFE_INTEGER } from 'helper/number/const';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Repeats the `subject` number of `times`.\n *\n * @function repeat\n * @static\n * @since 1.0.0\n * @memberOf Manipulate\n * @param {string} [subject=''] The string to repeat.\n * @param {number} [times=1] The number of times to repeat.\n * @return {string} Returns the repeated string.\n * @example\n * v.repeat('w', 3);\n * // => 'www'\n *\n * v.repeat('world', 0);\n * // => ''\n */\nexport default function repeat(subject, times) {\n let subjectString = coerceToString(subject);\n let timesInt = isNil(times) ? 1 : clipNumber(toInteger(times), 0, MAX_SAFE_INTEGER);\n let repeatString = '';\n while (timesInt) {\n if (timesInt & 1) {\n repeatString += subjectString;\n }\n if (timesInt > 1) {\n subjectString += subjectString;\n }\n timesInt >>= 1;\n }\n return repeatString;\n}","import repeat from 'manipulate/repeat';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Creates the padding string.\n *\n * @ignore\n * @param {string} padCharacters The characters to create padding string.\n * @param {number} length The padding string length.\n * @return {string} The padding string.\n */\nexport default function buildPadding(padCharacters, length) {\n const padStringRepeat = toInteger(length / padCharacters.length);\n const padStringRest = length % padCharacters.length;\n return repeat(padCharacters, padStringRepeat + padStringRest).substr(0, length);\n}","import buildPadding from 'helper/string/build_padding';\nimport clipNumber from 'helper/number/clip_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport { MAX_SAFE_INTEGER } from 'helper/number/const';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Pads `subject` from left to a new `length`.\n *\n * @function padLeft\n * @static\n * @since 1.0.0\n * @memberOf Manipulate\n * @param {string} [subject=''] The string to pad.\n * @param {int} [length=0] The length to left pad the string. No changes are made if `length` is less than `subject.length`.\n * @param {string} [pad=' '] The string to be used for padding.\n * @return {string} Returns the left padded string.\n * @example\n * v.padLeft('dog', 5);\n * // => ' dog'\n *\n * v.padLeft('bird', 6, '-');\n * // => '--bird'\n *\n * v.padLeft('cat', 6, '-=');\n * // => '-=-cat'\n */\nexport default function padLeft(subject, length, pad) {\n const subjectString = coerceToString(subject);\n const lengthInt = isNil(length) ? 0 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);\n const padString = coerceToString(pad, ' ');\n if (lengthInt <= subjectString.length) {\n return subjectString;\n }\n return buildPadding(padString, lengthInt - subjectString.length) + subjectString;\n}","import buildPadding from 'helper/string/build_padding';\nimport clipNumber from 'helper/number/clip_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport { MAX_SAFE_INTEGER } from 'helper/number/const';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Pads `subject` from right to a new `length`.\n *\n * @function padRight\n * @static\n * @since 1.0.0\n * @memberOf Manipulate\n * @param {string} [subject=''] The string to pad.\n * @param {int} [length=0] The length to right pad the string. No changes are made if `length` is less than `subject.length`.\n * @param {string} [pad=' '] The string to be used for padding.\n * @return {string} Returns the right padded string.\n * @example\n * v.padRight('dog', 5);\n * // => 'dog '\n *\n * v.padRight('bird', 6, '-');\n * // => 'bird--'\n *\n * v.padRight('cat', 6, '-=');\n * // => 'cat-=-'\n */\nexport default function padRight(subject, length, pad) {\n const subjectString = coerceToString(subject);\n const lengthInt = isNil(length) ? 0 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);\n const padString = coerceToString(pad, ' ');\n if (lengthInt <= subjectString.length) {\n return subjectString;\n }\n return subjectString + buildPadding(padString, lengthInt - subjectString.length);\n}","import isNil from 'helper/object/is_nil';\nimport { LITERAL_MINUS } from 'helper/format/const';\nimport padLeft from 'manipulate/pad_left';\nimport padRight from 'manipulate/pad_right';\n\n/**\n * Aligns and pads `subject` string.\n *\n * @ignore\n * @param {string} subject The subject string.\n * @param {ConversionSpecification} conversion The conversion specification object.\n * @return {string} Returns the aligned and padded string.\n */\nexport default function alignAndPad(subject, conversion) {\n const width = conversion.width;\n if (isNil(width) || subject.length >= width) {\n return subject;\n }\n const padType = conversion.alignmentSpecifier === LITERAL_MINUS ? padRight : padLeft;\n return padType(subject, width, conversion.getPaddingCharacter());\n}","import { LITERAL_PLUS } from 'helper/format/const';\n\n/**\n * Add sign to the formatted number.\n *\n * @ignore\n * @name addSignToFormattedNumber\n * @param {number} replacementNumber The number to be replaced.\n * @param {string} formattedReplacement The formatted version of number.\n * @param {ConversionSpecification} conversion The conversion specification object.\n * @return {string} Returns the formatted number string with a sign.\n */\nexport default function addSignToFormattedNumber(replacementNumber, formattedReplacement, conversion) {\n if (conversion.signSpecifier === LITERAL_PLUS && replacementNumber >= 0) {\n formattedReplacement = LITERAL_PLUS + formattedReplacement;\n }\n return formattedReplacement;\n}","import {\n TYPE_FLOAT,\n TYPE_FLOAT_SCIENTIFIC,\n TYPE_FLOAT_SCIENTIFIC_UPPERCASE,\n TYPE_FLOAT_SHORT,\n TYPE_FLOAT_SHORT_UPPERCASE\n} from 'helper/format/const';\nimport addSignToFormattedNumber from 'helper/format/type_format/add_sign_to_formatted_number';\nimport coerceToNumber from 'helper/number/coerce_to_number';\nimport { REGEXP_TRAILING_ZEROS } from 'helper/reg_exp/const';\nimport toString from 'helper/string/coerce_to_string';\n\n/**\n * Formats a float type according to specifiers.\n *\n * @ignore\n * @param {string} replacement The string to be formatted.\n * @param {ConversionSpecification} conversion The conversion specification object.\n * @return {string} Returns the formatted string.\n */\n\nexport default function float(replacement, conversion) {\n let replacementNumber = parseFloat(replacement);\n let formattedReplacement;\n if (isNaN(replacementNumber)) {\n replacementNumber = 0;\n }\n const precision = coerceToNumber(conversion.precision, 6);\n switch (conversion.typeSpecifier) {\n case TYPE_FLOAT:\n formattedReplacement = replacementNumber.toFixed(precision);\n break;\n case TYPE_FLOAT_SCIENTIFIC:\n formattedReplacement = replacementNumber.toExponential(precision);\n break;\n case TYPE_FLOAT_SCIENTIFIC_UPPERCASE:\n formattedReplacement = replacementNumber.toExponential(precision).toUpperCase();\n break;\n case TYPE_FLOAT_SHORT:\n case TYPE_FLOAT_SHORT_UPPERCASE:\n formattedReplacement = formatFloatAsShort(replacementNumber, precision, conversion);\n break;\n }\n formattedReplacement = addSignToFormattedNumber(replacementNumber, formattedReplacement, conversion);\n return toString(formattedReplacement);\n}\n\n/**\n * Formats the short float.\n *\n * @ignore\n * @param {number} replacementNumber The number to format.\n * @param {number} precision The precision to format the float.\n * @param {ConversionSpecification} conversion The conversion specification object.\n * @return {string} Returns the formatted short float.\n */\nfunction formatFloatAsShort(replacementNumber, precision, conversion) {\n if (replacementNumber === 0) {\n return '0';\n }\n const nonZeroPrecision = precision === 0 ? 1 : precision;\n let formattedReplacement = replacementNumber\n .toPrecision(nonZeroPrecision)\n .replace(REGEXP_TRAILING_ZEROS, '');\n if (conversion.typeSpecifier === TYPE_FLOAT_SHORT_UPPERCASE) {\n formattedReplacement = formattedReplacement.toUpperCase();\n }\n return formattedReplacement;\n}","import {\n RADIX_BINARY,\n RADIX_HEXADECIMAL,\n RADIX_OCTAL,\n TYPE_INTEGER_ASCII_CHARACTER,\n TYPE_INTEGER_BINARY,\n TYPE_INTEGER_HEXADECIMAL,\n TYPE_INTEGER_HEXADECIMAL_UPPERCASE,\n TYPE_INTEGER_OCTAL\n} from 'helper/format/const';\nimport toString from 'helper/string/coerce_to_string';\n\n/**\n * Formats an integer type according to specifiers.\n *\n * @ignore\n * @param {string} replacement The string to be formatted.\n * @param {ConversionSpecification} conversion The conversion specification object.\n * @return {string} Returns the formatted string.\n */\n\nexport default function integerBase(replacement, conversion) {\n let integer = parseInt(replacement);\n if (isNaN(integer)) {\n integer = 0;\n }\n integer = integer >>> 0;\n switch (conversion.typeSpecifier) {\n case TYPE_INTEGER_ASCII_CHARACTER:\n integer = String.fromCharCode(integer);\n break;\n case TYPE_INTEGER_BINARY:\n integer = integer.toString(RADIX_BINARY);\n break;\n case TYPE_INTEGER_OCTAL:\n integer = integer.toString(RADIX_OCTAL);\n break;\n case TYPE_INTEGER_HEXADECIMAL:\n integer = integer.toString(RADIX_HEXADECIMAL);\n break;\n case TYPE_INTEGER_HEXADECIMAL_UPPERCASE:\n integer = integer.toString(RADIX_HEXADECIMAL).toUpperCase();\n break;\n }\n return toString(integer);\n}","import addSignToFormattedNumber from 'helper/format/type_format/add_sign_to_formatted_number';\nimport toString from 'helper/string/to_string';\n\n/**\n * Formats a decimal integer type according to specifiers.\n *\n * @ignore\n * @param {string} replacement The string to be formatted.\n * @param {ConversionSpecification} conversion The conversion specification object.\n * @return {string} Returns the formatted string.\n */\n\nexport default function integerDecimal(replacement, conversion) {\n let integer = parseInt(replacement);\n if (isNaN(integer)) {\n integer = 0;\n }\n return addSignToFormattedNumber(integer, toString(integer), conversion);\n}","import isNil from 'helper/object/is_nil';\nimport truncate from 'chop/truncate';\n\n/**\n * Formats a string type according to specifiers.\n *\n * @ignore\n * @param {string} replacement The string to be formatted.\n * @param {ConversionSpecification} conversion The conversion specification object.\n * @return {string} Returns the formatted string.\n */\nexport default function stringFormat(replacement, conversion) {\n let formattedReplacement = replacement;\n const precision = conversion.precision;\n if (!isNil(precision) && formattedReplacement.length > precision) {\n formattedReplacement = truncate(formattedReplacement, precision, '');\n }\n return formattedReplacement;\n}","import {\n TYPE_FLOAT,\n TYPE_FLOAT_SCIENTIFIC,\n TYPE_FLOAT_SCIENTIFIC_UPPERCASE,\n TYPE_FLOAT_SHORT,\n TYPE_FLOAT_SHORT_UPPERCASE,\n TYPE_INTEGER,\n TYPE_INTEGER_ASCII_CHARACTER,\n TYPE_INTEGER_BINARY,\n TYPE_INTEGER_DECIMAL,\n TYPE_INTEGER_HEXADECIMAL,\n TYPE_INTEGER_HEXADECIMAL_UPPERCASE,\n TYPE_INTEGER_OCTAL,\n TYPE_INTEGER_UNSIGNED_DECIMAL,\n TYPE_STRING\n} from 'helper/format/const';\nimport alignAndPad from 'helper/format/align_and_pad';\nimport formatFloat from 'helper/format/type_format/float';\nimport formatIntegerBase from 'helper/format/type_format/integer_base';\nimport formatIntegerDecimal from 'helper/format/type_format/integer_decimal';\nimport formatString from 'helper/format/type_format/string';\n\n/**\n * Returns the computed string based on format specifiers.\n *\n * @ignore\n * @name computeReplacement\n * @param {string} replacement The replacement value.\n * @param {ConversionSpecification} conversion The conversion specification object.\n * @return {string} Returns the computed string.\n */\nexport default function compute(replacement, conversion) {\n let formatFunction;\n switch (conversion.typeSpecifier) {\n case TYPE_STRING:\n formatFunction = formatString;\n break;\n case TYPE_INTEGER_DECIMAL:\n case TYPE_INTEGER:\n formatFunction = formatIntegerDecimal;\n break;\n case TYPE_INTEGER_ASCII_CHARACTER:\n case TYPE_INTEGER_BINARY:\n case TYPE_INTEGER_OCTAL:\n case TYPE_INTEGER_HEXADECIMAL:\n case TYPE_INTEGER_HEXADECIMAL_UPPERCASE:\n case TYPE_INTEGER_UNSIGNED_DECIMAL:\n formatFunction = formatIntegerBase;\n break;\n case TYPE_FLOAT:\n case TYPE_FLOAT_SCIENTIFIC:\n case TYPE_FLOAT_SCIENTIFIC_UPPERCASE:\n case TYPE_FLOAT_SHORT:\n case TYPE_FLOAT_SHORT_UPPERCASE:\n formatFunction = formatFloat;\n break;\n }\n const formattedString = formatFunction(replacement, conversion);\n return alignAndPad(formattedString, conversion);\n}","import { LITERAL_PERCENT_SPECIFIER, LITERAL_SINGLE_QUOTE } from 'helper/format/const';\nimport nilDefault from 'helper/undefined/nil_default';\n\n/**\n * Construct the new conversion specification object.\n *\n * @ignore\n * @param {Object} properties An object with properties to initialize.\n * @return {ConversionSpecification} ConversionSpecification instance.\n */\nfunction ConversionSpecification(properties) {\n\n /**\n * The percent characters from conversion specification.\n *\n * @ignore\n * @name ConversionSpecification#percent\n * @type {string}\n */\n this.percent = properties.percent;\n\n /**\n * The sign specifier to force a sign to be used on a number.\n *\n * @ignore\n * @name ConversionSpecification#signSpecifier\n * @type {string}\n */\n this.signSpecifier = properties.signSpecifier;\n\n /**\n * The padding specifier that says what padding character will be used.\n *\n * @ignore\n * @name ConversionSpecification#paddingSpecifier\n * @type {string}\n */\n this.paddingSpecifier = properties.paddingSpecifier;\n\n /**\n * The alignment specifier that says if the result should be left-justified or right-justified.\n *\n * @ignore\n * @name ConversionSpecification#alignmentSpecifier\n * @type {string}\n */\n this.alignmentSpecifier = properties.alignmentSpecifier;\n\n /**\n * The width specifier how many characters this conversion should result in.\n *\n * @ignore\n * @name ConversionSpecification#width\n * @type {number}\n */\n this.width = properties.width;\n\n /**\n * The precision specifier says how many decimal digits should be displayed for floating-point numbers.\n *\n * @ignore\n * @name ConversionSpecification#precision\n * @type {number}\n */\n this.precision = properties.precision;\n\n /**\n * The type specifier says what type the argument data should be treated as.\n *\n * @ignore\n * @name ConversionSpecification#typeSpecifier\n * @type {string}\n */\n this.typeSpecifier = properties.typeSpecifier;\n}\n\n\n/**\n * Check if the conversion specification is a percent literal \"%%\".\n *\n * @ignore\n * @return {boolean} Returns true if the conversion is a percent literal, false otherwise.\n */\nConversionSpecification.prototype.isPercentLiteral = function() {\n return LITERAL_PERCENT_SPECIFIER === this.percent;\n};\n\n/**\n * Get the padding character from padding specifier.\n *\n * @ignore\n * @returns {string} Returns the padding character.\n */\nConversionSpecification.prototype.getPaddingCharacter = function() {\n let paddingCharacter = nilDefault(this.paddingSpecifier, ' ');\n if (paddingCharacter.length === 2 && paddingCharacter[0] === LITERAL_SINGLE_QUOTE) {\n paddingCharacter = paddingCharacter[1];\n }\n return paddingCharacter;\n};\n\nexport default ConversionSpecification;","import isNil from 'helper/object/is_nil';\n\n/**\n * Validates the specifier type and replacement position.\n *\n * @ignore\n * @throws {Error} Throws an exception on insufficient arguments or unknown specifier.\n * @param {number} index The index of the matched specifier.\n * @param {number} replacementsLength The number of replacements.\n * @param {ConversionSpecification} conversion The conversion specification object.\n * @return {undefined}\n */\nexport default function validate(index, replacementsLength, conversion) {\n if (isNil(conversion.typeSpecifier)) {\n throw new Error('sprintf(): Unknown type specifier');\n }\n if (index > replacementsLength - 1) {\n throw new Error('sprintf(): Too few arguments');\n }\n if (index < 0) {\n throw new Error('sprintf(): Argument number must be greater than zero');\n }\n}","import coerceToNumber from 'helper/number/coerce_to_number';\nimport computeReplacement from 'helper/format/replacement/compute';\nimport ConversionSpecification from 'helper/format/conversion_specification';\nimport validateReplacement from 'helper/format/replacement/validate';\n\n/**\n * Return the replacement for regular expression match of the conversion specification.\n *\n * @ignore\n * @name matchReplacement\n * @param {ReplacementIndex} replacementIndex The replacement index object.\n * @param {string[]} replacements The array of replacements.\n * @param {string} conversionSpecification The conversion specification.\n * @param {string} percent The percent characters from conversion specification.\n * @param {string} position The position to insert the replacement.\n * @param {string} signSpecifier The sign specifier to force a sign to be used on a number.\n * @param {string} paddingSpecifier The padding specifier that says what padding character will be used.\n * @param {string} alignmentSpecifier The alignment specifier that says if the result should be left-justified or right-justified.\n * @param {string} widthSpecifier The width specifier how many characters this conversion should result in.\n * @param {string} precisionSpecifier The precision specifier says how many decimal digits should be displayed for floating-point numbers.\n * @param {string} typeSpecifier The type specifier says what type the argument data should be treated as.\n * @return {string} Returns the computed replacement.\n */\nexport default function match(replacementIndex, replacements, conversionSpecification, percent, position, signSpecifier,\n paddingSpecifier, alignmentSpecifier, widthSpecifier, precisionSpecifier, typeSpecifier) {\n const conversion = new ConversionSpecification({\n percent,\n signSpecifier,\n paddingSpecifier,\n alignmentSpecifier,\n width: coerceToNumber(widthSpecifier, null),\n precision: coerceToNumber(precisionSpecifier, null),\n typeSpecifier\n });\n if (conversion.isPercentLiteral()) {\n return conversionSpecification.slice(1);\n }\n const actualReplacementIndex = replacementIndex.getIndexByPosition(position);\n replacementIndex.incrementOnEmptyPosition(position);\n validateReplacement(actualReplacementIndex, replacements.length, conversion);\n return computeReplacement(replacements[actualReplacementIndex], conversion);\n}","import coerceToString from 'helper/string/coerce_to_string';\nimport { REGEXP_CONVERSION_SPECIFICATION } from 'helper/reg_exp/const';\nimport ReplacementIndex from 'helper/format/replacement/index.js';\nimport replacementMatch from 'helper/format/replacement/match';\n\n/**\n * Produces a string according to `format`.\n *\n *
%
), which are copied unchanged\n * to the output string and conversion specifications, each of which results in fetching zero or more subsequent\n * arguments. %
, and ends with a conversion\n * specifier. In between there may be (in this order) zero or more flags, an optional minimum field width\n * and an optional precision.%
is followed by zero or more of the following flags:+ | \n * \n * A sign (+ or - ) should always be placed before a number produced by a\n * signed conversion. By default a sign is used only for negative numbers.\n * | \n *
0 | \n * The value should be zero padded. | \n *
␣ | \n * (a space) The value should be space padded. | \n *
' | \n * Indicates alternate padding character, specified by prefixing it with a single quote ' . | \n *
- | \n * The converted value is to be left adjusted on the field boundary (the default is right justification). | \n *
`s` | \n *The string argument is treated as and presented as a string. | \n *
`d` `i` | \n *The integer argument is converted to signed decimal notation. | \n *
`b` | \n *The unsigned integer argument is converted to unsigned binary. | \n *
`c` | \n *The unsigned integer argument is converted to an ASCII character with that number. | \n *
`o` | \n *The unsigned integer argument is converted to unsigned octal. | \n *
`u` | \n *The unsigned integer argument is converted to unsigned decimal. | \n *
`x` `X` | \n *The unsigned integer argument is converted to unsigned hexadecimal. The letters `abcdef` are used for `x`\n * conversions; the letters `ABCDEF` are used for `X` conversions. | \n *
`f` | \n *\n * The float argument is rounded and converted to decimal notation in the style `[-]ddd.ddd`, where the number of\n * digits after the decimal-point character is equal to the precision specification. If the precision is missing,\n * it is taken as 6; if the precision is explicitly zero, no decimal-point character appears.\n * If a decimal point appears, at least one digit appears before it.\n * | \n *
`e` `E` | \n *\n * The float argument is rounded and converted in the style `[-]d.ddde±dd`, where there is one digit\n * before the decimal-point character and the number of digits after it is equal to the precision. If\n * the precision is missing, it is taken as `6`; if the precision is zero, no decimal-point character\n * appears. An `E` conversion uses the letter `E` (rather than `e`) to introduce the exponent.\n * | \n *
`g` `G` | \n *\n * The float argument is converted in style `f` or `e` (or `F` or `E` for `G` conversions). The precision specifies\n * the number of significant digits. If the precision is missing, `6` digits are given; if the\n * precision is zero, it is treated as `1`. Style `e` is used if the exponent from its conversion is less\n * than `-6` or greater than or equal to the precision. Trailing zeros are removed from the fractional\n * part of the result; a decimal point appears only if it is followed by at least one digit.\n * | \n *
`%` | \n *A literal `%` is written. No argument is converted. The complete conversion specification is `%%`. | \n *
sprintf()
,\n * with the only difference that accepts the formatting arguments in an array `values`.< > & ' \" `
in subject
.\n *\n * @function escapeHtml\n * @static\n * @since 1.0.0 \n * @memberOf Escape\n * @param {string} [subject=''] The string to escape.\n * @return {string} Returns the escaped string.\n * @example\n * v.escapeHtml('wonderful world
');\n * // => '<p>wonderful world</p>'\n */\nexport default function escapeHtml(subject) {\n return coerceToString(subject).replace(REGEXP_HTML_SPECIAL_CHARACTERS, replaceSpecialCharacter);\n}","import coerceToString from 'helper/string/coerce_to_string';\nimport { REGEXP_SPECIAL_CHARACTERS } from 'helper/reg_exp/const';\n\n/**\n * Escapes the regular expression special characters `- [ ] / { } ( ) * + ? . \\ ^ $ |` in `subject`.\n *\n * @function escapeRegExp\n * @static\n * @since 1.0.0\n * @memberOf Escape\n * @param {string} [subject=''] The string to escape.\n * @return {string} Returns the escaped string.\n * @example\n * v.escapeRegExp('(hours)[minutes]{seconds}');\n * // => '\\(hours\\)\\[minutes\\]\\{seconds\\}'\n */\nexport default function escapeRegExp(subject) {\n return coerceToString(subject).replace(REGEXP_SPECIAL_CHARACTERS, '\\\\$&');\n}","import coerceToString from 'helper/string/coerce_to_string';\n\nconst unescapeCharactersMap = {\n '<': /(<)|(*3c;)|(*60;)/gi,\n '>': /(>)|(*3e;)|(*62;)/gi,\n '&': /(&)|(*26;)|(*38;)/gi,\n '\"': /(")|(*22;)|(*34;)/gi,\n \"'\": /(*27;)|(*39;)/gi,\n '`': /(*60;)|(*96;)/gi\n};\nconst characters = Object.keys(unescapeCharactersMap);\n\n/**\n * Replaces the HTML entities with corresponding characters.\n *\n * @ignore\n * @param {string} string The accumulator string.\n * @param {string} key The character.\n * @return {string} The string with replaced HTML entity\n */\nfunction reduceUnescapedString(string, key) {\n return string.replace(unescapeCharactersMap[key], key);\n}\n\n/**\n * Unescapes HTML special characters from< > & " ' `
\n * to corresponding < > & ' \" `
in subject
.\n *\n * @function unescapeHtml\n * @static\n * @since 1.0.0\n * @memberOf Escape\n * @param {string} [subject=''] The string to unescape.\n * @return {string} Returns the unescaped string.\n * @example\n * v.unescapeHtml('<p>wonderful world</p>');\n * // => 'wonderful world
'\n */\nexport default function unescapeHtml(subject) {\n const subjectString = coerceToString(subject);\n return characters.reduce(reduceUnescapedString, subjectString);\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Returns the first occurrence index of `search` in `subject`.\n *\n * @function indexOf\n * @static\n * @since 1.0.0\n * @memberOf Index\n * @param {string} [subject=''] The string where to search.\n * @param {string} search The string to search.\n * @param {number} [fromIndex=0] The index to start searching.\n * @return {number} Returns the first occurrence index or `-1` if not found.\n * @example\n * v.indexOf('morning', 'n');\n * // => 3\n *\n * v.indexOf('evening', 'o');\n * // => -1\n */\nexport default function indexOf(subject, search, fromIndex) {\n const subjectString = coerceToString(subject);\n return subjectString.indexOf(search, fromIndex);\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Returns the last occurrence index of `search` in `subject`.\n *\n * @function lastIndexOf\n * @static\n * @since 1.0.0\n * @memberOf Index\n * @param {string} [subject=''] The string where to search.\n * @param {string} search The string to search.\n * @param {number} [fromIndex=subject.length - 1] The index to start searching backward in the string.\n * @return {number} Returns the last occurrence index or `-1` if not found.\n * @example\n * v.lastIndexOf('morning', 'n');\n * // => 5\n *\n * v.lastIndexOf('evening', 'o');\n * // => -1\n */\nexport default function lastIndexOf(subject, search, fromIndex) {\n const subjectString = coerceToString(subject);\n return subjectString.lastIndexOf(search, fromIndex);\n}","import clipNumber from 'helper/number/clip_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Returns the first index of a `pattern` match in `subject`.\n *\n * @function search\n * @static\n * @since 1.0.0\n * @memberOf Index\n * @param {string} [subject=''] The string where to search.\n * @param {string|RegExp} pattern The pattern to match. If `pattern` is not RegExp, it is transformed to `new RegExp(pattern)`.\n * @param {number} [fromIndex=0] The index to start searching.\n * @return {number} Returns the first match index or `-1` if not found.\n * @example\n * v.search('morning', /rn/);\n * // => 2\n *\n * v.search('evening', '/\\d/');\n * // => -1\n */\nexport default function search(subject, pattern, fromIndex) {\n const subjectString = coerceToString(subject);\n const fromIndexNumber = isNil(fromIndex) ? 0 : clipNumber(toInteger(fromIndex), 0, subjectString.length);\n let matchIndex = subjectString.substr(fromIndexNumber).search(pattern);\n if (matchIndex !== -1 && !isNaN(fromIndexNumber)) {\n matchIndex += fromIndexNumber;\n }\n return matchIndex;\n}","import coerceToNumber from 'helper/number/coerce_to_number';\nimport coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Inserts into `subject` a string `toInsert` at specified `position`.\n *\n * @function insert\n * @static\n * @since 1.0.0\n * @memberOf Manipulate\n * @param {string} [subject=''] The string where to insert.\n * @param {string} [toInsert=''] The string to be inserted.\n * @param {number} [position=0] The position to insert.\n * @return {string} Returns the string after insertion.\n * @example\n * v.insert('ct', 'a', 1);\n * // => 'cat'\n *\n * v.insert('sunny', ' day', 5);\n * // => 'sunny day'\n */\nexport default function insert(subject, toInsert, position) {\n const subjectString = coerceToString(subject);\n const toInsertString = coerceToString(toInsert);\n const positionNumber = coerceToNumber(position);\n if (positionNumber < 0 || positionNumber > subjectString.length || toInsertString === '') {\n return subjectString;\n }\n return subjectString.slice(0, positionNumber) + toInsertString + subjectString.slice(positionNumber);\n}","/**\n * Generated diacritics map. See bellow the base code.\n * @ignore\n * @see http://stackoverflow.com/a/18391901/1894471\n * @type Object\n */\n\nconst diacritics = {\n \"3\": \"\\u039e\\u03be\",\n \"8\": \"\\u0398\\u03b8\",\n \"A\": \"\\x41\\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\u0100\\u0102\\u0104\\u01cd\\u01de\\u01e0\\u01fa\\u0200\\u0202\\u0226\\u023a\\u1e00\\u1ea0\\u1ea2\\u1ea4\\u1ea6\\u1ea8\\u1eaa\\u1eac\\u1eae\\u1eb0\\u1eb2\\u1eb4\\u1eb6\\u24b6\\u2c6f\\uff21\\u0386\\u0391\\u0410\",\n \"B\": \"\\x42\\u0181\\u0182\\u0243\\u1e02\\u1e04\\u1e06\\u24b7\\uff22\\u0392\\u0411\",\n \"C\": \"\\x43\\xc7\\u0106\\u0108\\u010a\\u010c\\u0187\\u023b\\u1e08\\u24b8\\ua73e\\uff23\\u0426\",\n \"D\": \"\\x44\\u010e\\u0110\\u0189\\u018a\\u018b\\u1e0a\\u1e0c\\u1e0e\\u1e10\\u1e12\\u24b9\\ua779\\uff24\\xd0\\u0394\\u0414\",\n \"E\": \"\\x45\\xc8\\xc9\\xca\\xcb\\u0112\\u0114\\u0116\\u0118\\u011a\\u018e\\u0190\\u0204\\u0206\\u0228\\u1e14\\u1e16\\u1e18\\u1e1a\\u1e1c\\u1eb8\\u1eba\\u1ebc\\u1ebe\\u1ec0\\u1ec2\\u1ec4\\u1ec6\\u24ba\\uff25\\u0388\\u0395\\u0415\\u042d\",\n \"F\": \"\\x46\\u0191\\u1e1e\\u24bb\\ua77b\\uff26\\u03a6\\u0424\",\n \"G\": \"\\x47\\u011c\\u011e\\u0120\\u0122\\u0193\\u01e4\\u01e6\\u01f4\\u1e20\\u24bc\\ua77d\\ua77e\\ua7a0\\uff27\\u0393\\u0413\\u0490\",\n \"H\": \"\\x48\\u0124\\u0126\\u021e\\u1e22\\u1e24\\u1e26\\u1e28\\u1e2a\\u24bd\\u2c67\\u2c75\\ua78d\\uff28\\u0389\\u0397\\u0425\",\n \"I\": \"\\x49\\xcc\\xcd\\xce\\xcf\\u0128\\u012a\\u012c\\u012e\\u0130\\u0197\\u01cf\\u0208\\u020a\\u1e2c\\u1e2e\\u1ec8\\u1eca\\u24be\\uff29\\u038a\\u0399\\u03aa\\u0406\\u0418\",\n \"J\": \"\\x4a\\u0134\\u0248\\u24bf\\uff2a\\u0419\",\n \"K\": \"\\x4b\\u0136\\u0198\\u01e8\\u1e30\\u1e32\\u1e34\\u24c0\\u2c69\\ua740\\ua742\\ua744\\ua7a2\\uff2b\\u039a\\u041a\",\n \"L\": \"\\x4c\\u0139\\u013b\\u013d\\u013f\\u0141\\u023d\\u1e36\\u1e38\\u1e3a\\u1e3c\\u24c1\\u2c60\\u2c62\\ua746\\ua748\\ua780\\uff2c\\u039b\\u041b\",\n \"M\": \"\\x4d\\u019c\\u1e3e\\u1e40\\u1e42\\u24c2\\u2c6e\\uff2d\\u039c\\u041c\",\n \"N\": \"\\x4e\\xd1\\u0143\\u0145\\u0147\\u019d\\u01f8\\u0220\\u1e44\\u1e46\\u1e48\\u1e4a\\u24c3\\ua790\\ua7a4\\uff2e\\u039d\\u041d\",\n \"O\": \"\\x4f\\xd2\\xd3\\xd4\\xd5\\xd6\\xd8\\u014c\\u014e\\u0150\\u0186\\u019f\\u01a0\\u01d1\\u01ea\\u01ec\\u01fe\\u020c\\u020e\\u022a\\u022c\\u022e\\u0230\\u1e4c\\u1e4e\\u1e50\\u1e52\\u1ecc\\u1ece\\u1ed0\\u1ed2\\u1ed4\\u1ed6\\u1ed8\\u1eda\\u1edc\\u1ede\\u1ee0\\u1ee2\\u24c4\\ua74a\\ua74c\\uff2f\\u038c\\u039f\\u041e\",\n \"P\": \"\\x50\\u01a4\\u1e54\\u1e56\\u24c5\\u2c63\\ua750\\ua752\\ua754\\uff30\\u03a0\\u041f\",\n \"Q\": \"\\x51\\u024a\\u24c6\\ua756\\ua758\\uff31\",\n \"R\": \"\\x52\\u0154\\u0156\\u0158\\u0210\\u0212\\u024c\\u1e58\\u1e5a\\u1e5c\\u1e5e\\u24c7\\u2c64\\ua75a\\ua782\\ua7a6\\uff32\\u03a1\\u0420\",\n \"S\": \"\\x53\\u015a\\u015c\\u015e\\u0160\\u0218\\u1e60\\u1e62\\u1e64\\u1e66\\u1e68\\u1e9e\\u24c8\\u2c7e\\ua784\\ua7a8\\uff33\\u03a3\\u0421\",\n \"T\": \"\\x54\\u0162\\u0164\\u0166\\u01ac\\u01ae\\u021a\\u023e\\u1e6a\\u1e6c\\u1e6e\\u1e70\\u24c9\\ua786\\uff34\\u03a4\\u0422\",\n \"U\": \"\\x55\\xd9\\xda\\xdb\\xdc\\u0168\\u016a\\u016c\\u016e\\u0170\\u0172\\u01af\\u01d3\\u01d5\\u01d7\\u01d9\\u01db\\u0214\\u0216\\u0244\\u1e72\\u1e74\\u1e76\\u1e78\\u1e7a\\u1ee4\\u1ee6\\u1ee8\\u1eea\\u1eec\\u1eee\\u1ef0\\u24ca\\uff35\\u0423\\u042a\",\n \"V\": \"\\x56\\u01b2\\u0245\\u1e7c\\u1e7e\\u24cb\\ua75e\\uff36\\u0412\",\n \"W\": \"\\x57\\u0174\\u1e80\\u1e82\\u1e84\\u1e86\\u1e88\\u24cc\\u2c72\\uff37\\u038f\\u03a9\",\n \"X\": \"\\x58\\u1e8a\\u1e8c\\u24cd\\uff38\\u03a7\",\n \"Y\": \"\\x59\\xdd\\u0176\\u0178\\u01b3\\u0232\\u024e\\u1e8e\\u1ef2\\u1ef4\\u1ef6\\u1ef8\\u1efe\\u24ce\\uff39\\u038e\\u03a5\\u03ab\\u042b\",\n \"Z\": \"\\x5a\\u0179\\u017b\\u017d\\u01b5\\u0224\\u1e90\\u1e92\\u1e94\\u24cf\\u2c6b\\u2c7f\\ua762\\uff3a\\u0396\\u0417\",\n \"a\": \"\\x61\\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\u0101\\u0103\\u0105\\u01ce\\u01df\\u01e1\\u01fb\\u0201\\u0203\\u0227\\u0250\\u1e01\\u1e9a\\u1ea1\\u1ea3\\u1ea5\\u1ea7\\u1ea9\\u1eab\\u1ead\\u1eaf\\u1eb1\\u1eb3\\u1eb5\\u1eb7\\u24d0\\u2c65\\uff41\\u03ac\\u03b1\\u0430\",\n \"b\": \"\\x62\\u0180\\u0183\\u0253\\u1e03\\u1e05\\u1e07\\u24d1\\uff42\\u03b2\\u0431\",\n \"c\": \"\\x63\\xe7\\u0107\\u0109\\u010b\\u010d\\u0188\\u023c\\u1e09\\u2184\\u24d2\\ua73f\\uff43\\u0446\",\n \"d\": \"\\x64\\u010f\\u0111\\u018c\\u0256\\u0257\\u1e0b\\u1e0d\\u1e0f\\u1e11\\u1e13\\u24d3\\ua77a\\uff44\\xf0\\u03b4\\u0434\",\n \"e\": \"\\x65\\xe8\\xe9\\xea\\xeb\\u0113\\u0115\\u0117\\u0119\\u011b\\u01dd\\u0205\\u0207\\u0229\\u0247\\u025b\\u1e15\\u1e17\\u1e19\\u1e1b\\u1e1d\\u1eb9\\u1ebb\\u1ebd\\u1ebf\\u1ec1\\u1ec3\\u1ec5\\u1ec7\\u24d4\\uff45\\u03ad\\u03b5\\u0435\\u044d\",\n \"f\": \"\\x66\\u0192\\u1e1f\\u24d5\\ua77c\\uff46\\u03c6\\u0444\",\n \"g\": \"\\x67\\u011d\\u011f\\u0121\\u0123\\u01e5\\u01e7\\u01f5\\u0260\\u1d79\\u1e21\\u24d6\\ua77f\\ua7a1\\uff47\\u03b3\\u0433\\u0491\",\n \"h\": \"\\x68\\u0125\\u0127\\u021f\\u0265\\u1e23\\u1e25\\u1e27\\u1e29\\u1e2b\\u1e96\\u24d7\\u2c68\\u2c76\\uff48\\u03ae\\u03b7\\u0445\",\n \"i\": \"\\x69\\xec\\xed\\xee\\xef\\u0129\\u012b\\u012d\\u012f\\u0131\\u01d0\\u0209\\u020b\\u0268\\u1e2d\\u1e2f\\u1ec9\\u1ecb\\u24d8\\uff49\\u0390\\u03af\\u03b9\\u03ca\\u0438\\u0456\",\n \"j\": \"\\x6a\\u0135\\u01f0\\u0249\\u24d9\\uff4a\\u0439\",\n \"k\": \"\\x6b\\u0137\\u0199\\u01e9\\u1e31\\u1e33\\u1e35\\u24da\\u2c6a\\ua741\\ua743\\ua745\\ua7a3\\uff4b\\u03ba\\u043a\",\n \"l\": \"\\x6c\\u013a\\u013c\\u013e\\u0140\\u0142\\u017f\\u019a\\u026b\\u1e37\\u1e39\\u1e3b\\u1e3d\\u24db\\u2c61\\ua747\\ua749\\ua781\\uff4c\\u03bb\\u043b\",\n \"m\": \"\\x6d\\u026f\\u0271\\u1e3f\\u1e41\\u1e43\\u24dc\\uff4d\\u03bc\\u043c\",\n \"n\": \"\\x6e\\xf1\\u0144\\u0146\\u0148\\u0149\\u019e\\u01f9\\u0272\\u1e45\\u1e47\\u1e49\\u1e4b\\u24dd\\ua791\\ua7a5\\uff4e\\u03bd\\u043d\",\n \"o\": \"\\x6f\\xf2\\xf3\\xf4\\xf5\\xf6\\xf8\\u014d\\u014f\\u0151\\u01a1\\u01d2\\u01eb\\u01ed\\u01ff\\u020d\\u020f\\u022b\\u022d\\u022f\\u0231\\u0254\\u0275\\u1e4d\\u1e4f\\u1e51\\u1e53\\u1ecd\\u1ecf\\u1ed1\\u1ed3\\u1ed5\\u1ed7\\u1ed9\\u1edb\\u1edd\\u1edf\\u1ee1\\u1ee3\\u24de\\ua74b\\ua74d\\uff4f\\u03bf\\u03cc\\u043e\",\n \"p\": \"\\x70\\u01a5\\u1d7d\\u1e55\\u1e57\\u24df\\ua751\\ua753\\ua755\\uff50\\u03c0\\u043f\",\n \"q\": \"\\x71\\u024b\\u24e0\\ua757\\ua759\\uff51\",\n \"r\": \"\\x72\\u0155\\u0157\\u0159\\u0211\\u0213\\u024d\\u027d\\u1e59\\u1e5b\\u1e5d\\u1e5f\\u24e1\\ua75b\\ua783\\ua7a7\\uff52\\u03c1\\u0440\",\n \"s\": \"\\x73\\xdf\\u015b\\u015d\\u015f\\u0161\\u0219\\u023f\\u1e61\\u1e63\\u1e65\\u1e67\\u1e69\\u1e9b\\u24e2\\ua785\\ua7a9\\uff53\\u03c2\\u03c3\\u0441\",\n \"t\": \"\\x74\\u0163\\u0165\\u0167\\u01ad\\u021b\\u0288\\u1e6b\\u1e6d\\u1e6f\\u1e71\\u1e97\\u24e3\\u2c66\\ua787\\uff54\\u03c4\\u0442\",\n \"u\": \"\\x75\\xf9\\xfa\\xfb\\xfc\\u0169\\u016b\\u016d\\u016f\\u0171\\u0173\\u01b0\\u01d4\\u01d6\\u01d8\\u01da\\u01dc\\u0215\\u0217\\u0289\\u1e73\\u1e75\\u1e77\\u1e79\\u1e7b\\u1ee5\\u1ee7\\u1ee9\\u1eeb\\u1eed\\u1eef\\u1ef1\\u24e4\\uff55\\u0443\\u044a\",\n \"v\": \"\\x76\\u028b\\u028c\\u1e7d\\u1e7f\\u24e5\\ua75f\\uff56\\u0432\",\n \"w\": \"\\x77\\u0175\\u1e81\\u1e83\\u1e85\\u1e87\\u1e89\\u1e98\\u24e6\\u2c73\\uff57\\u03c9\\u03ce\",\n \"x\": \"\\x78\\u1e8b\\u1e8d\\u24e7\\uff58\\u03c7\",\n \"y\": \"\\x79\\xfd\\xff\\u0177\\u01b4\\u0233\\u024f\\u1e8f\\u1e99\\u1ef3\\u1ef5\\u1ef7\\u1ef9\\u1eff\\u24e8\\uff59\\u03b0\\u03c5\\u03cb\\u03cd\\u044b\",\n \"z\": \"\\x7a\\u017a\\u017c\\u017e\\u01b6\\u0225\\u0240\\u1e91\\u1e93\\u1e95\\u24e9\\u2c6c\\ua763\\uff5a\\u03b6\\u0437\",\n \"OE\": \"\\x8c\\u0152\",\n \"oe\": \"\\x9c\\u0153\",\n \"AE\": \"\\xc6\\u01e2\\u01fc\",\n \"ae\": \"\\xe6\\u01e3\\u01fd\",\n \"hv\": \"\\u0195\",\n \"OI\": \"\\u01a2\",\n \"oi\": \"\\u01a3\",\n \"DZ\": \"\\u01c4\\u01f1\",\n \"Dz\": \"\\u01c5\\u01f2\",\n \"dz\": \"\\u01c6\\u01f3\",\n \"LJ\": \"\\u01c7\",\n \"Lj\": \"\\u01c8\",\n \"lj\": \"\\u01c9\",\n \"NJ\": \"\\u01ca\",\n \"Nj\": \"\\u01cb\",\n \"nj\": \"\\u01cc\",\n \"OU\": \"\\u0222\",\n \"ou\": \"\\u0223\",\n \"TZ\": \"\\ua728\",\n \"tz\": \"\\ua729\",\n \"AA\": \"\\ua732\",\n \"aa\": \"\\ua733\",\n \"AO\": \"\\ua734\",\n \"ao\": \"\\ua735\",\n \"AU\": \"\\ua736\",\n \"au\": \"\\ua737\",\n \"AV\": \"\\ua738\\ua73a\",\n \"av\": \"\\ua739\\ua73b\",\n \"AY\": \"\\ua73c\",\n \"ay\": \"\\ua73d\",\n \"OO\": \"\\ua74e\",\n \"oo\": \"\\ua74f\",\n \"VY\": \"\\ua760\",\n \"vy\": \"\\ua761\",\n \"TH\": \"\\xde\",\n \"th\": \"\\xfe\",\n \"PS\": \"\\u03a8\",\n \"ps\": \"\\u03c8\",\n \"Yo\": \"\\u0401\",\n \"Ye\": \"\\u0404\",\n \"Yi\": \"\\u0407\",\n \"Zh\": \"\\u0416\",\n \"Ch\": \"\\u0427\",\n \"Sh\": \"\\u0428\\u0429\",\n \"\": \"\\u042c\\u044c\",\n \"Yu\": \"\\u042e\",\n \"Ya\": \"\\u042f\",\n \"zh\": \"\\u0436\",\n \"ch\": \"\\u0447\",\n \"sh\": \"\\u0448\\u0449\",\n \"yu\": \"\\u044e\",\n \"ya\": \"\\u044f\",\n \"yo\": \"\\u0451\",\n \"ye\": \"\\u0454\",\n \"yi\": \"\\u0457\"\n};\n\nlet diacriticsMap = null;\n\n/**\n * Creates a map of the diacritics.\n *\n * @ignore\n * @returns {Object} Returns the diacritics map.\n */\nfunction getDiacriticsMap() {\n if (diacriticsMap !== null) {\n return diacriticsMap;\n }\n diacriticsMap = {};\n Object.keys(diacritics).forEach(function(key) {\n const characters = diacritics[key];\n for (let index = 0; index < characters.length; index++) {\n const character = characters[index];\n diacriticsMap[character] = key;\n }\n });\n return diacriticsMap;\n}\n\n/**\n * Get the latin character from character with diacritics.\n *\n * @ignore\n * @param {string} character The character with diacritics.\n * @returns {string} Returns the character without diacritics.\n */\nexport function getLatinCharacter(character) {\n const characterWithoutDiacritic = getDiacriticsMap()[character];\n return characterWithoutDiacritic ? characterWithoutDiacritic : character;\n}","import { REGEXP_COMBINING_MARKS, REGEXP_NON_LATIN } from 'helper/reg_exp/const';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport { getLatinCharacter } from 'helper/string/diacritics_map';\n\n/**\n * Returns the `cleanCharacter` from combining marks regular expression match.\n *\n * @ignore\n * @param {string} character The character with combining marks\n * @param {string} cleanCharacter The character without combining marks.\n * @return {string} The character without combining marks.\n */\nfunction removeCombiningMarks(character, cleanCharacter) {\n return cleanCharacter;\n}\n\n/**\n * Latinises the `subject` by removing diacritic characters.\n *\n * @function latinise\n * @static\n * @since 1.0.0\n * @memberOf Manipulate\n * @param {string} [subject=''] The string to latinise.\n * @return {string} Returns the latinised string.\n * @example\n * v.latinise('cafe\\u0301'); // or 'café'\n * // => 'cafe'\n *\n * v.latinise('août décembre');\n * // => 'aout decembre'\n *\n * v.latinise('как прекрасен этот мир');\n * // => 'kak prekrasen etot mir'\n */\nexport default function latinise(subject) {\n const subjectString = coerceToString(subject);\n if (subjectString === '') {\n return '';\n }\n return subjectString\n .replace(REGEXP_NON_LATIN, getLatinCharacter)\n .replace(REGEXP_COMBINING_MARKS, removeCombiningMarks);\n}","import buildPadding from 'helper/string/build_padding';\nimport clipNumber from 'helper/number/clip_number';\nimport coerceToString from 'helper/string/coerce_to_string';\nimport isNil from 'helper/object/is_nil';\nimport { MAX_SAFE_INTEGER } from 'helper/number/const';\nimport toInteger from 'helper/number/to_integer';\n\n/**\n * Pads `subject` to a new `length`.\n *\n * @function pad\n * @static\n * @since 1.0.0\n * @memberOf Manipulate\n * @param {string} [subject=''] The string to pad.\n * @param {int} [length=0] The length to pad the string. No changes are made if `length` is less than `subject.length`.\n * @param {string} [pad=' '] The string to be used for padding.\n * @return {string} Returns the padded string.\n * @example\n * v.pad('dog', 5);\n * // => ' dog '\n *\n * v.pad('bird', 6, '-');\n * // => '-bird-'\n *\n * v.pad('cat', 6, '-=');\n * // => '-cat-='\n */\nexport default function pad(subject, length, pad) {\n const subjectString = coerceToString(subject);\n const lengthInt = isNil(length) ? 0 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);\n const padString = coerceToString(pad, ' ');\n if (lengthInt <= subjectString.length) {\n return subjectString;\n }\n const paddingLength = lengthInt - subjectString.length;\n const paddingSideLength = toInteger(paddingLength / 2);\n const paddingSideRemainingLength = paddingLength % 2;\n return buildPadding(padString, paddingSideLength) + subjectString +\n buildPadding(padString, paddingSideLength + paddingSideRemainingLength);\n}","import coerceToString from 'helper/string/coerce_to_string';\n\n/**\n * Replaces the matches of `pattern` with `replacement`.