{ "version": 3, "sources": ["../lib/main.js", "../lib/index.js"], "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE = /%(?:([1-9]\\d*)\\$)?([0 +\\-#]*)(\\*|\\d+)?(?:(\\.)(\\*|\\d+)?)?[hlL]?([%A-Za-z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Parses a delimiter.\n*\n* @private\n* @param {Array} match - regular expression match\n* @returns {Object} delimiter token object\n*/\nfunction parse( match ) {\n\tvar token = {\n\t\t'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0,\n\t\t'flags': match[ 2 ],\n\t\t'width': match[ 3 ],\n\t\t'precision': match[ 5 ],\n\t\t'specifier': match[ 6 ]\n\t};\n\tif ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) {\n\t\ttoken.precision = '1';\n\t}\n\treturn token;\n}\n\n\n// MAIN //\n\n/**\n* Tokenizes a string into an array of string parts and format identifier objects.\n*\n* @param {string} str - input string\n* @returns {Array} tokens\n*\n* @example\n* var tokens = formatTokenize( 'Hello %s!' );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\nfunction formatTokenize( str ) {\n\tvar content;\n\tvar tokens;\n\tvar match;\n\tvar prev;\n\n\ttokens = [];\n\tprev = 0;\n\tmatch = RE.exec( str );\n\twhile ( match ) {\n\t\tcontent = str.slice( prev, RE.lastIndex - match[ 0 ].length );\n\t\tif ( content.length ) {\n\t\t\ttokens.push( content );\n\t\t}\n\t\ttokens.push( parse( match ) );\n\t\tprev = RE.lastIndex;\n\t\tmatch = RE.exec( str );\n\t}\n\tcontent = str.slice( prev );\n\tif ( content.length ) {\n\t\ttokens.push( content );\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nmodule.exports = formatTokenize;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Tokenize a string into an array of string parts and format identifier objects.\n*\n* @module @stdlib/string-base-format-tokenize\n*\n* @example\n* var formatTokenize = require( '@stdlib/string-base-format-tokenize' );\n*\n* var str = 'Hello %s!';\n* var tokens = formatTokenize( str );\n* // returns [ 'Hello ', {...}, '!' ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAK,6EAYT,SAASC,EAAOC,EAAQ,CACvB,IAAIC,EAAQ,CACX,QAAaD,EAAO,CAAE,EAAM,SAAUA,EAAO,CAAE,EAAG,EAAG,EAAI,OACzD,MAASA,EAAO,CAAE,EAClB,MAASA,EAAO,CAAE,EAClB,UAAaA,EAAO,CAAE,EACtB,UAAaA,EAAO,CAAE,CACvB,EACA,OAAKA,EAAO,CAAE,IAAM,KAAOA,EAAO,CAAE,IAAM,SACzCC,EAAM,UAAY,KAEZA,CACR,CAeA,SAASC,EAAgBC,EAAM,CAC9B,IAAIC,EACAC,EACAL,EACAM,EAKJ,IAHAD,EAAS,CAAC,EACVC,EAAO,EACPN,EAAQF,EAAG,KAAMK,CAAI,EACbH,GACPI,EAAUD,EAAI,MAAOG,EAAMR,EAAG,UAAYE,EAAO,CAAE,EAAE,MAAO,EACvDI,EAAQ,QACZC,EAAO,KAAMD,CAAQ,EAEtBC,EAAO,KAAMN,EAAOC,CAAM,CAAE,EAC5BM,EAAOR,EAAG,UACVE,EAAQF,EAAG,KAAMK,CAAI,EAEtB,OAAAC,EAAUD,EAAI,MAAOG,CAAK,EACrBF,EAAQ,QACZC,EAAO,KAAMD,CAAQ,EAEfC,CACR,CAKAR,EAAO,QAAUK,ICtDjB,IAAIK,EAAO,IAKX,OAAO,QAAUA", "names": ["require_main", "__commonJSMin", "exports", "module", "RE", "parse", "match", "token", "formatTokenize", "str", "content", "tokens", "prev", "main"] }