You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kieffer@RWK-Mac-2017$ node --use-strict
> function foo() {}
undefined
> foo.name
'foo'
> foo.name='bar'
TypeError: Cannot assign to read only property 'name' of function 'function foo() {}'
at repl:1:9
at ContextifyScript.Script.runInThisContext (vm.js:23:33)
at REPLServer.defaultEval (repl.js:339:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:536:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:191:7)
at REPLServer.Interface._onLine (readline.js:241:10)
at REPLServer.Interface._line (readline.js:590:8)
> Object.defineProperty(foo, 'name', {value: 'bar'})
[Function: bar]
> foo.name
'bar'
https://github.com/kelektiv/node-uuid/blob/17d443f7d8cfb65a7d85803218df27a6b4ae8397/lib/v35.js#L46
The above line is assigning to a read-only variable, which is a violation when running in strict mode (via Node's
--use_strict
argument).Outside of strict mode, this doesn't actually result in the function name being changed anyway, as assignments to
Function.name
are ignored.There are other ways to change the name of a function that hopefully would work.
If I comment that line out, everything works fine, with no other errors.
The text was updated successfully, but these errors were encountered: