mirror of https://github.com/sveltejs/svelte
fix escaping/unescaping — closes #741
parent
057a257482
commit
a524ab273e
@ -1,3 +1,7 @@
|
||||
export default function stringify(data: string) {
|
||||
export function stringify(data: string) {
|
||||
return JSON.stringify(data.replace(/([^\\@#])?([@#])/g, '$1\\$2'));
|
||||
}
|
||||
|
||||
export function escape(data: string) {
|
||||
return data.replace(/([^\\@#])?([@#])/g, '$1\\$2');
|
||||
}
|
||||
|
Loading…
Reference in new issue