nikhilk / scriptsharp

Script# Project - a C# to JavaScript compiler, to power your HTML5 and Node.js web development.
http://scriptsharp.com
Other
658 stars 182 forks source link

Uncaught TypeError: Object function String() { [native code] } has no method 'format' #394

Open MaxEden opened 11 years ago

MaxEden commented 11 years ago

ss.js

_formatters['Number'] = function(number, format, culture) { ... case 'p': case 'P': if (precision == -1) { precision = nf.perDD; } s = (Math.abs(number) * 100.0).toFixed(precision).toString(); if (precision && (nf.perDS != '.')) { var index = s.indexOf('.'); s = s.substr(0, index) + nf.perDS + s.substr(index + 1); } s = _commaFormatNumber(s, nf.perGW, nf.perDS, nf.perGS); if (number < 0) { s = String.format(culture, nf.perNP, s); } else { s = String.format(culture, nf.perPP, s); } break;

Possibly there should be ss.format

nikhilk commented 11 years ago

Yes - looks leftover from previous implementation that didn't get cleaned up. There are couple more occurrences that need to be addressed in this: https://github.com/nikhilk/scriptsharp/blob/cc/src/Core/Scripts/Runtime/Format.js

I will get to them, or feel free to change and submit a pull request, and I'll merge.