MCPcopy Create free account
hub / github.com/sveltejs/devalue / stringify_string

Function stringify_string

src/utils.js:87–102  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

85
86/** @param {string} str */
87export function stringify_string(str) {
88 let result = '';
89 let last_pos = 0;
90 const len = str.length;
91
92 for (let i = 0; i < len; i += 1) {
93 const char = str[i];
94 const replacement = get_escaped_char(char);
95 if (replacement) {
96 result += str.slice(last_pos, i) + replacement;
97 last_pos = i + 1;
98 }
99 }
100
101 return `"${last_pos === 0 ? str : result + str.slice(last_pos)}"`;
102}
103
104/** @param {Record<string | symbol, any>} object */
105export function enumerable_symbols(object) {

Callers 5

flattenFunction · 0.90
stringify_primitiveFunction · 0.90
stringifyFunction · 0.90
unevalFunction · 0.90
stringify_primitiveFunction · 0.90

Calls 1

get_escaped_charFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…