class method SpahQL.DataHelper.coerceKeyForObject
SpahQL.DataHelper.coerceKeyForObject(key, obj) → String, Integer, null
- key (Integer, String): The key to be coerced.
- obj (Object): The value being inspected
When you want to set a key on an anonymous object, you’ll want to coerce the key to the correct type - numbers for arrays, strings for objects. This function does that. Returns null if the key can’t be coerced for the given object.