@csegames/camelot-unchained
Version:
Camelot Unchained Client Library
32 lines (31 loc) • 896 B
JavaScript
;
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
Object.defineProperty(exports, "__esModule", { value: true });
function clone(obj) {
return Object.assign({}, obj);
}
exports.clone = clone;
function merge(obj) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return Object.assign.apply(Object, [{}, obj].concat(args));
}
exports.merge = merge;
function tryParseJSON(json, logError) {
if (logError === void 0) {
logError = false;
}
try {
return JSON.parse(json);
} catch (e) {
if (logError) console.error("Failed to parse json. | " + json);
return null;
}
}
exports.tryParseJSON = tryParseJSON;