dan.the.discloser
dan.the.discloser•3y ago

can i bypass strict mode?

When I try use Deno Run , it complains error: Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them const answer = o[s];
export function func(o: object, s : string) {
const answer = o[s];
return answer}
export function func(o: object, s : string) {
const answer = o[s];
return answer}
^
5 Replies
dan.the.discloser
dan.the.discloserOP•3y ago
Looks like I can use javascript for the particular function if there isn't a better way
Andreu Botella
Andreu Botella•3y ago
strict mode is enabled by default and can't be disabled in ESM modules and Deno is built on ESM
dan.the.discloser
dan.the.discloserOP•3y ago
thank you. looks I can't even import it as java script. Is there some other way when I am using Object.getOwnPropertyNames rather than just getting the names, to get the current values?
Doctor 🤖
Doctor 🤖•3y ago
Object.keys()?
const obj = {
a: 1,
b: 2,
c: 3
}

Object.keys(obj) // ['a', 'b', 'c']
Object.values(obj) // [1, 2, 3]
Object.entries(obj) // [['a', 1], ['b', 2], ['c', 3]]
const obj = {
a: 1,
b: 2,
c: 3
}

Object.keys(obj) // ['a', 'b', 'c']
Object.values(obj) // [1, 2, 3]
Object.entries(obj) // [['a', 1], ['b', 2], ['c', 3]]
dan.the.discloser
dan.the.discloserOP•3y ago
Is there a version that will work on function objects?
> function bite(t : any){assert(false); console.log(`bite ${t}`)}
undefined
> Object.getPrototypeOf(bite)
[Object]
> Object.keys(bite)
[]
> Object.getOwnPropertyNames(bite)
[ "length", "name", "prototype" ]
> Object.values(bite)
[]
> Object.entries(bite)
[]
> function bite(t : any){assert(false); console.log(`bite ${t}`)}
undefined
> Object.getPrototypeOf(bite)
[Object]
> Object.keys(bite)
[]
> Object.getOwnPropertyNames(bite)
[ "length", "name", "prototype" ]
> Object.values(bite)
[]
> Object.entries(bite)
[]

Did you find this page helpful?