Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F21588840
wrap-attributes.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
414 B
Referenced Files
None
Subscribers
None
wrap-attributes.ts
View Options
export
function
needsQuotes
(
str
:
string
)
{
try
{
// eslint-disable-next-line @typescript-eslint/no-implied-eval
new
Function
(
`var obj = {
${
str
}
: 1 };`
);
return
false
;
}
catch
{
return
true
;
}
}
export
function
wrapAttribute
(
name
:
string
)
{
return
needsQuotes
(
name
)
?
`["
${
name
}
"]`
:
`.
${
name
}
`
;
}
export
function
wrapKeyName
(
name
:
string
)
{
return
needsQuotes
(
name
)
?
`["
${
name
}
"]`
:
`
${
name
}
`
;
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, Nov 7, 15:29 (16 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1181861
Default Alt Text
wrap-attributes.ts (414 B)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline