| 15604 | |
| 15605 | |
| 15606 | function getStringValue(name) { |
| 15607 | // Property names must be strings. This means that non-string objects cannot be used |
| 15608 | // as keys in an object. Any non-string object, including a number, is typecasted |
| 15609 | // into a string via the toString method. |
| 15610 | // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names |
| 15611 | // |
| 15612 | // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it |
| 15613 | // to a string. It's not always possible. If `name` is an object and its `toString` method is |
| 15614 | // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown: |
| 15615 | // |
| 15616 | // TypeError: Cannot convert object to primitive value |
| 15617 | // |
| 15618 | // For performance reasons, we don't catch this error here and allow it to propagate up the call |
| 15619 | // stack. Note that you'll get the same error in JavaScript if you try to access a property using |
| 15620 | // such a 'broken' object as a key. |
| 15621 | return name + ''; |
| 15622 | } |
| 15623 | |
| 15624 | |
| 15625 | var OPERATORS = createMap(); |