1 | 'use strict';
|
2 | var global = require('../internals/global');
|
3 | var apply = require('../internals/function-apply');
|
4 | var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
|
5 | var fails = require('../internals/fails');
|
6 | var arraySlice = require('../internals/array-slice');
|
7 |
|
8 | var Int8Array = global.Int8Array;
|
9 | var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
10 | var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
11 | var $toLocaleString = [].toLocaleString;
|
12 |
|
13 |
|
14 | var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () {
|
15 | $toLocaleString.call(new Int8Array(1));
|
16 | });
|
17 |
|
18 | var FORCED = fails(function () {
|
19 | return [1, 2].toLocaleString() !== new Int8Array([1, 2]).toLocaleString();
|
20 | }) || !fails(function () {
|
21 | Int8Array.prototype.toLocaleString.call([1, 2]);
|
22 | });
|
23 |
|
24 |
|
25 |
|
26 | exportTypedArrayMethod('toLocaleString', function toLocaleString() {
|
27 | return apply(
|
28 | $toLocaleString,
|
29 | TO_LOCALE_STRING_BUG ? arraySlice(aTypedArray(this)) : aTypedArray(this),
|
30 | arraySlice(arguments)
|
31 | );
|
32 | }, FORCED);
|