mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
18 lines
300 B
JavaScript
18 lines
300 B
JavaScript
/**
|
|
* Escapes a string for inclusion into a lua string
|
|
*/
|
|
function escapeString(content) {
|
|
return content
|
|
.replace(/\\/g, "\\\\")
|
|
.replace(/"/g, '\\"')
|
|
.replace(/'/g, "\\'")
|
|
.replace(/\0/g, "\\0")
|
|
.replace(/\n/g, "\\n")
|
|
.replace(/\r/g, "\\r")
|
|
;
|
|
}
|
|
|
|
module.exports = {
|
|
escapeString,
|
|
}
|