Skip to content

Xotic750/create-array-fix-x

Repository files navigation

Travis status Dependency status devDependency status npm version

create-array-fix-x

Address Safari 10.1 array bug: https://bugs.webkit.org/show_bug.cgi?id=170264

Version: 0.1.0
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750

module.exports([parameters])Object

Address Safari 10.1 array bug: https://bugs.webkit.org/show_bug.cgi?id=170264

Kind: Exported function
Returns: Object - An array or array subclass if array is broken.

Param Type Description
[parameters] number | * The construction parameters.

Example

var createArray = require('create-array-fix-x');

createArray(); // []
createArray(5); // [, , , , , ]
createArray(1, 2, 3, 4, 5); // [1, 2, 3, 4, 5]

// adressed bug
var testArray = createArrayFix(0, 2147483648); // Note: the second number is greater than a signed 32bit int
testArray.shift(); // remove the first element so arr is [2147483648]
testArray[1] = 1; // Safari fails to add the new element and the array is unchanged
testArray; // [2147483648, 1]