graphonline/script/utils.js
Oleg Sh 0e00aa0f32 Fix print background
Add vertex shape to settings
Fix separate style
2021-04-16 20:47:10 +02:00

44 lines
881 B
JavaScript

function gEncodeToHTML(str)
{
if (typeof str !== 'string')
return str;
return str.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&apos;');
}
function gDecodeFromHTML(str)
{
if (typeof str !== 'string')
return str;
return str.replace(/&apos;/g, "'")
.replace(/&quot;/g, '"')
.replace(/&gt;/g, '>')
.replace(/&lt;/g, '<')
.replace(/&amp;/g, '&');
}
function FullObjectCopy(obj)
{
var newObj = Object.create(Object.getPrototypeOf(obj));
return Object.assign(newObj, obj);
}
function FullArrayCopy(arr)
{
var res = [];
arr.forEach(function(element) {
var copyElement = FullObjectCopy(element);
res.push(copyElement);
});
return res;
}