mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
Split up codebase into the packages @clsterio/lib, @clusterio/master, @clusterio/slave, and @clusterio/ctl using lerna to manage them. This will allow deployment to use only the parts needed reducing install size, and better separate the code into shared library, master, slave and control.
27 lines
456 B
JavaScript
27 lines
456 B
JavaScript
/**
|
|
* Utilities for dealing with Lua
|
|
* @module
|
|
*/
|
|
"use strict";
|
|
|
|
/**
|
|
* Escapes a string for inclusion into a lua string
|
|
*
|
|
* @param {string} content - String to escape.
|
|
* @returns {string} Escaped 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,
|
|
};
|