Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Degrees of Lewdity Plus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Averall
Degrees of Lewdity Plus
Commits
97d77d3a
Commit
97d77d3a
authored
2 years ago
by
Jimmy
Browse files
Options
Downloads
Patches
Plain Diff
Style clean-up of stringFrom
parent
1be86a19
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
game/00-framework-tools/03-Patcher/stringFromPatcher.js
+38
-36
38 additions, 36 deletions
game/00-framework-tools/03-Patcher/stringFromPatcher.js
with
38 additions
and
36 deletions
game/00-framework-tools/03-Patcher/stringFromPatcher.js
+
38
−
36
View file @
97d77d3a
...
@@ -2,66 +2,68 @@
...
@@ -2,66 +2,68 @@
Returns the simple string representation of the given value or, if there is
Returns the simple string representation of the given value or, if there is
none, a square bracketed representation.
none, a square bracketed representation.
*/
*/
stringFrom
=
function
(
value
)
{
// eslint-disable-next-line no-global-assign
stringFrom
=
function
(
value
)
{
switch
(
typeof
value
)
{
switch
(
typeof
value
)
{
case
'
function
'
:
case
"
function
"
:
return
'
[function]
'
;
return
"
[function]
"
;
case
'
number
'
:
case
"
number
"
:
if
(
Number
.
isNaN
(
value
))
{
if
(
Number
.
isNaN
(
value
))
{
return
'
[number NaN]
'
;
return
"
[number NaN]
"
;
}
}
break
;
break
;
case
'
object
'
:
case
"
object
"
:
if
(
value
===
null
)
{
if
(
value
===
null
)
{
return
'
[null]
'
;
return
"
[null]
"
;
}
}
else
if
(
value
instanceof
Array
)
{
else
if
(
value
instanceof
Array
)
{
return
value
.
map
(
val
=>
stringFrom
(
val
)).
join
(
"
,
"
);
return
value
.
map
(
val
=>
stringFrom
(
val
)).
join
(
'
,
'
);
}
else
if
(
value
instanceof
Set
)
{
}
return
Array
.
from
(
value
)
else
if
(
value
instanceof
Set
)
{
.
map
(
val
=>
stringFrom
(
val
))
return
Array
.
from
(
value
).
map
(
val
=>
stringFrom
(
val
))
.
join
(
'
,
'
);
.
join
(
"
,
"
);
}
}
else
if
(
value
instanceof
Map
)
{
else
if
(
value
instanceof
Map
)
{
const
result
=
Array
.
from
(
value
).
map
(
const
result
=
Array
.
from
(
value
).
map
(
([
key
,
val
])
=>
`
${
stringFrom
(
key
)}
\u2192
${
stringFrom
(
val
)}
`
);
([
key
,
val
])
=>
`
${
stringFrom
(
key
)}
\u2192
${
stringFrom
(
val
)}
`
return
`{\u202F
${
result
.
join
(
'
,
'
)}
\u202F}`
;
)
;
}
return
`{\u202F
${
result
.
join
(
"
,
"
)}
\u202F}`
;
else
if
(
value
instanceof
Date
)
{
}
else
if
(
value
instanceof
Date
)
{
return
value
.
toLocaleString
();
return
value
.
toLocaleString
();
}
}
else
if
(
value
instanceof
Element
)
{
else
if
(
value
instanceof
Element
)
{
if
(
if
(
value
===
document
.
documentElement
value
===
document
.
documentElement
||
||
value
===
document
.
head
value
===
document
.
head
||
||
value
===
document
.
body
value
===
document
.
body
)
{
)
{
throw
new
Error
(
'
illegal operation; attempting to convert the <html>, <head>, or <body> tags to string is not allowed
'
);
throw
new
Error
(
"
illegal operation; attempting to convert the <html>, <head>, or <body> tags to string is not allowed
"
);
}
}
return
value
.
outerHTML
;
return
value
.
outerHTML
;
}
}
else
if
(
value
instanceof
Node
)
{
else
if
(
value
instanceof
Node
)
{
return
value
.
textContent
;
return
value
.
textContent
;
}
}
else
if
(
typeof
value
.
toString
===
"
function
"
)
{
else
if
(
typeof
value
.
toString
===
'
function
'
)
{
return
value
.
toString
();
return
value
.
toString
();
}
}
return
Object
.
prototype
.
toString
.
call
(
value
);
return
Object
.
prototype
.
toString
.
call
(
value
);
case
'
symbol
'
:
{
case
"
symbol
"
:
{
const
desc
=
typeof
value
.
description
!==
'
undefined
'
?
` "
${
value
.
description
}
"`
:
''
;
const
desc
=
typeof
value
.
description
!==
"
undefined
"
?
` "
${
value
.
description
}
"`
:
""
;
return
`[symbol
${
desc
}
]`
;
return
`[symbol
${
desc
}
]`
;
}
}
case
'
undefined
'
:
case
"
undefined
"
:
if
(
V
&&
(
V
.
debugdisable
===
'
f
'
||
V
.
debug
===
1
))
{
if
(
V
&&
(
V
.
debugdisable
===
"
f
"
||
V
.
debug
===
1
))
{
Errors
.
report
(
'
Print macro attempted to return an undefined variable in
'
+
Utils
.
GetStack
());
Errors
.
report
(
"
Print macro attempted to return an undefined variable in
"
+
Utils
.
GetStack
()
);
}
}
return
V
&&
V
.
debug
?
'
[undefined]
'
:
''
;
return
V
&&
V
.
debug
?
"
[undefined]
"
:
""
;
}
}
return
String
(
value
);
return
String
(
value
);
}
}
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment