
I have a fairly simple function that takes in a string of position parameters (e.g. "height: 200, width: 100, x: 10, y: 20"), and converts that into an object with the respective key/value pairs. Here is the code: const options = {} _ . each (params . split ( /,\s *? / gu ) , v => { options[v . split ( /\s *? :\s *? / gu )[ 0 ]] = parseInt (v . split ( /\s *? :\s *? / gu )[ 1 ] ) } ) D . Log ( ` Parsed Options: ${ JSON . stringify ( options ) }` ) D . Log ( ` Height: ${ JSON . stringify ( options . height) } , Width: ${ JSON . stringify ( options . width) } , X: ${ JSON . stringify ( options . x) } , Y: ${ JSON . stringify ( options . y) }` ) ("D.Log" is just a wrapper around log so that I can turn off debug reports with a global.) The weirdness: When I pass in a string, say, "height: -33, width: -35, x: 0, y: 0", my log output reads thusly: "DERIVED OPTIONS: {height: -33, width: -35, x: 0, y: 0}" "Height: -33, Width: <UNDEFINED>, X: <UNDEFINED>, Y: <UNDEFINED>" The only difference between the two log entries is that I'm calling the properties individually in the second one, rather than outputting the whole object. How could my options object have four valid properties when I stringify it the first time, but then three of the four properties are undefined on the very next line? I'm utterly baffled.