printPropertyDescriptor(String, 'format');
String.format = 42;
console.log("String.format = " + String.format);
function printPropertyDescriptor(obj, name) {
var descriptor = Object.getOwnPropertyDescriptor(obj, 'clearTimeout');
var formatted = JSON.stringify(descriptor, null, 2);
console.log(name + " = " + formatted);
}
Expected result:
[INFO] : format = { …some flags here… }
[INFO] : String.format = 42
Actual result:
[INFO] : format = undefined
[INFO] : String.format = function format() {
[INFO] : [native code]
[INFO] : }
Here’s the culprit: https://github.com/appcelerator/titanium_mobile/blob/2c7f6fb74fa772e1ecc8d9d5209f83c4a0c06aab/iphone/Classes/KrollContext.m#L1203
This issue can be extended to include
String.format
,String.formatDate
,String.formatTime
,String.formatDecimal
andString.formatCurrency
.