mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-25 09:16:17 -04:00
change comments
This commit is contained in:
parent
15b426ebb6
commit
c0e84dcd50
1 changed files with 5 additions and 15 deletions
|
@ -61,9 +61,7 @@ class PHPSerialize extends Operation {
|
||||||
if (typeof content === "boolean") {
|
if (typeof content === "boolean") {
|
||||||
return `${basicTypes.boolean}:${content ? 1 : 0}`;
|
return `${basicTypes.boolean}:${content ? 1 : 0}`;
|
||||||
}
|
}
|
||||||
/**
|
/* Numbers */
|
||||||
* Numbers
|
|
||||||
*/
|
|
||||||
if (typeof content === "number") {
|
if (typeof content === "number") {
|
||||||
if (isInteger(content)) {
|
if (isInteger(content)) {
|
||||||
return `${basicTypes.integer}:${content.toString()}`;
|
return `${basicTypes.integer}:${content.toString()}`;
|
||||||
|
@ -71,9 +69,7 @@ class PHPSerialize extends Operation {
|
||||||
return `${basicTypes.float}:${content.toString()}`;
|
return `${basicTypes.float}:${content.toString()}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/* Strings */
|
||||||
* Strings
|
|
||||||
*/
|
|
||||||
if (typeof content === "string")
|
if (typeof content === "string")
|
||||||
return `${basicTypes.string}:${content.length}:"${content}"`;
|
return `${basicTypes.string}:${content.length}:"${content}"`;
|
||||||
|
|
||||||
|
@ -87,22 +83,16 @@ class PHPSerialize extends Operation {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function serialize(object) {
|
function serialize(object) {
|
||||||
/**
|
/* Null */
|
||||||
* Null
|
|
||||||
*/
|
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
return `N;`;
|
return `N;`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof object !== "object") {
|
if (typeof object !== "object") {
|
||||||
/**
|
/* Basic types */
|
||||||
* Basic types
|
|
||||||
*/
|
|
||||||
return `${serializeBasicTypes(object)};`;
|
return `${serializeBasicTypes(object)};`;
|
||||||
} else if (object instanceof Array) {
|
} else if (object instanceof Array) {
|
||||||
/**
|
/* Arrays */
|
||||||
* Arrays
|
|
||||||
*/
|
|
||||||
const serializedElements = [];
|
const serializedElements = [];
|
||||||
|
|
||||||
for (let i = 0; i < object.length; i++) {
|
for (let i = 0; i < object.length; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue