MCPcopy
hub / github.com/t4t5/sweetalert / string

Function string

docs/assets/js/add-preview-buttons.js:50795–50847  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50793 }
50794 },
50795 string = function string() {
50796
50797 // Parse a string value.
50798
50799 var hex,
50800 i,
50801 string = '',
50802 delim,
50803 // double quote or single quote
50804 uffff;
50805
50806 // When parsing for string values, we must look for ' or " and \ characters.
50807
50808 if (ch === '"' || ch === "'") {
50809 delim = ch;
50810 while (next()) {
50811 if (ch === delim) {
50812 next();
50813 return string;
50814 } else if (ch === '\\') {
50815 next();
50816 if (ch === 'u') {
50817 uffff = 0;
50818 for (i = 0; i < 4; i += 1) {
50819 hex = parseInt(next(), 16);
50820 if (!isFinite(hex)) {
50821 break;
50822 }
50823 uffff = uffff * 16 + hex;
50824 }
50825 string += String.fromCharCode(uffff);
50826 } else if (ch === '\r') {
50827 if (peek() === '\n') {
50828 next();
50829 }
50830 } else if (typeof escapee[ch] === 'string') {
50831 string += escapee[ch];
50832 } else {
50833 break;
50834 }
50835 } else if (ch === '\n') {
50836 // unescaped newlines are invalid; see:
50837 // https://github.com/aseemk/json5/issues/24
50838 // TODO this feels special-cased; are there other
50839 // invalid unescaped chars?
50840 break;
50841 } else {
50842 string += ch;
50843 }
50844 }
50845 }
50846 error("Bad string");
50847 },
50848 inlineComment = function inlineComment() {
50849
50850 // Skip an inline comment, assuming this is one. The current character should

Callers 2

objectFunction · 0.70

Calls 3

nextFunction · 0.70
peekFunction · 0.70
errorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…