You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.1 KiB
32 lines
1.1 KiB
'use strict'; |
|
var global = require('../internals/global'); |
|
var apply = require('../internals/function-apply'); |
|
var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); |
|
var fails = require('../internals/fails'); |
|
var arraySlice = require('../internals/array-slice'); |
|
|
|
var Int8Array = global.Int8Array; |
|
var aTypedArray = ArrayBufferViewCore.aTypedArray; |
|
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; |
|
var $toLocaleString = [].toLocaleString; |
|
|
|
// iOS Safari 6.x fails here |
|
var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () { |
|
$toLocaleString.call(new Int8Array(1)); |
|
}); |
|
|
|
var FORCED = fails(function () { |
|
return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString(); |
|
}) || !fails(function () { |
|
Int8Array.prototype.toLocaleString.call([1, 2]); |
|
}); |
|
|
|
// `%TypedArray%.prototype.toLocaleString` method |
|
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring |
|
exportTypedArrayMethod('toLocaleString', function toLocaleString() { |
|
return apply( |
|
$toLocaleString, |
|
TO_LOCALE_STRING_BUG ? arraySlice(aTypedArray(this)) : aTypedArray(this), |
|
arraySlice(arguments) |
|
); |
|
}, FORCED);
|
|
|