array-fixed
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -8,2 +8,3 @@ 'use strict'; | ||
var _slicedToArray = _interopDefault(require('babel-runtime/helpers/slicedToArray')); | ||
var _Math$trunc = _interopDefault(require('babel-runtime/core-js/math/trunc')); | ||
var _getIterator = _interopDefault(require('babel-runtime/core-js/get-iterator')); | ||
@@ -108,5 +109,5 @@ var _Symbol$iterator = _interopDefault(require('babel-runtime/core-js/symbol/iterator')); | ||
slice(begin, end) { | ||
if (begin == null) begin = 0; | ||
if (end == null) end = this._array.length; | ||
slice(begin = 0, end = this._array.length) { | ||
begin = _Math$trunc(begin); | ||
end = _Math$trunc(end); | ||
if (begin < 0) { | ||
@@ -127,3 +128,4 @@ begin = Math.max(begin + this._array.length, 0); | ||
splice(indexStart, deleteCount, ...items) { | ||
splice(indexStart = 0, deleteCount, ...items) { | ||
indexStart = _Math$trunc(indexStart); | ||
// bound indexStart according to splice behaviour | ||
@@ -139,3 +141,3 @@ if (indexStart > this._array.length) { | ||
} else { | ||
// $FlowFixMe: cast nully to 0 | ||
// $FlowFixMe: casts nully to 0 AND also truncates to integer | ||
deleteCount = deleteCount | 0; | ||
@@ -493,5 +495,5 @@ } | ||
slice(begin, end) { | ||
if (begin == null) begin = 0; | ||
if (end == null) end = this._array.length; | ||
slice(begin = 0, end = this._array.length) { | ||
begin = _Math$trunc(begin); | ||
end = _Math$trunc(end); | ||
if (begin < 0) { | ||
@@ -512,3 +514,4 @@ begin = Math.max(begin + this._array.length, 0); | ||
splice(indexStart, deleteCount, ...items) { | ||
splice(indexStart = 0, deleteCount, ...items) { | ||
indexStart = _Math$trunc(indexStart); | ||
if (indexStart < 0) { | ||
@@ -530,3 +533,3 @@ indexStart = Math.max(indexStart + this._array.length, 0); | ||
} else { | ||
// $FlowFixMe: cast nully to 0 | ||
// $FlowFixMe: casts nully to 0 AND also truncates to integer | ||
deleteCount = deleteCount | 0; | ||
@@ -533,0 +536,0 @@ } |
import _slicedToArray from 'babel-runtime/helpers/slicedToArray'; | ||
import _Math$trunc from 'babel-runtime/core-js/math/trunc'; | ||
import _getIterator from 'babel-runtime/core-js/get-iterator'; | ||
@@ -101,5 +102,5 @@ import _Symbol$iterator from 'babel-runtime/core-js/symbol/iterator'; | ||
slice(begin, end) { | ||
if (begin == null) begin = 0; | ||
if (end == null) end = this._array.length; | ||
slice(begin = 0, end = this._array.length) { | ||
begin = _Math$trunc(begin); | ||
end = _Math$trunc(end); | ||
if (begin < 0) { | ||
@@ -120,3 +121,4 @@ begin = Math.max(begin + this._array.length, 0); | ||
splice(indexStart, deleteCount, ...items) { | ||
splice(indexStart = 0, deleteCount, ...items) { | ||
indexStart = _Math$trunc(indexStart); | ||
// bound indexStart according to splice behaviour | ||
@@ -132,3 +134,3 @@ if (indexStart > this._array.length) { | ||
} else { | ||
// $FlowFixMe: cast nully to 0 | ||
// $FlowFixMe: casts nully to 0 AND also truncates to integer | ||
deleteCount = deleteCount | 0; | ||
@@ -486,5 +488,5 @@ } | ||
slice(begin, end) { | ||
if (begin == null) begin = 0; | ||
if (end == null) end = this._array.length; | ||
slice(begin = 0, end = this._array.length) { | ||
begin = _Math$trunc(begin); | ||
end = _Math$trunc(end); | ||
if (begin < 0) { | ||
@@ -505,3 +507,4 @@ begin = Math.max(begin + this._array.length, 0); | ||
splice(indexStart, deleteCount, ...items) { | ||
splice(indexStart = 0, deleteCount, ...items) { | ||
indexStart = _Math$trunc(indexStart); | ||
if (indexStart < 0) { | ||
@@ -523,3 +526,3 @@ indexStart = Math.max(indexStart + this._array.length, 0); | ||
} else { | ||
// $FlowFixMe: cast nully to 0 | ||
// $FlowFixMe: casts nully to 0 AND also truncates to integer | ||
deleteCount = deleteCount | 0; | ||
@@ -526,0 +529,0 @@ } |
@@ -98,5 +98,8 @@ // @flow | ||
slice (begin: ?number, end: ?number): ArrayFixed<item> { | ||
if (begin == null) begin = 0; | ||
if (end == null) end = this._array.length; | ||
slice ( | ||
begin: number = 0, | ||
end: number = this._array.length | ||
): ArrayFixed<item> { | ||
begin = Math.trunc(begin); | ||
end = Math.trunc(end); | ||
if (begin < 0) { | ||
@@ -118,6 +121,7 @@ begin = Math.max(begin + this._array.length, 0); | ||
splice ( | ||
indexStart: number, | ||
indexStart: number = 0, | ||
deleteCount: ?number, | ||
...items: Array<item> | ||
): ArrayFixed<item> { | ||
indexStart = Math.trunc(indexStart); | ||
// bound indexStart according to splice behaviour | ||
@@ -133,3 +137,3 @@ if (indexStart > this._array.length) { | ||
} else { | ||
// $FlowFixMe: cast nully to 0 | ||
// $FlowFixMe: casts nully to 0 AND also truncates to integer | ||
deleteCount = deleteCount|0; | ||
@@ -136,0 +140,0 @@ } |
@@ -148,5 +148,8 @@ // @flow | ||
slice (begin: ?number, end: ?number): ArrayFixedDense<item, direction> { | ||
if (begin == null) begin = 0; | ||
if (end == null) end = this._array.length; | ||
slice ( | ||
begin: number = 0, | ||
end: number = this._array.length | ||
): ArrayFixedDense<item, direction> { | ||
begin = Math.trunc(begin); | ||
end = Math.trunc(end); | ||
if (begin < 0) { | ||
@@ -172,6 +175,7 @@ begin = Math.max(begin + this._array.length, 0); | ||
splice ( | ||
indexStart: number, | ||
indexStart: number = 0, | ||
deleteCount: ?number, | ||
...items: Array<item> | ||
): ArrayFixedDense<item, direction> { | ||
indexStart = Math.trunc(indexStart); | ||
if (indexStart < 0) { | ||
@@ -193,3 +197,3 @@ indexStart = Math.max(indexStart + this._array.length, 0); | ||
} else { | ||
// $FlowFixMe: cast nully to 0 | ||
// $FlowFixMe: casts nully to 0 AND also truncates to integer | ||
deleteCount = deleteCount|0; | ||
@@ -196,0 +200,0 @@ } |
{ | ||
"name": "array-fixed", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Array with a Fixed Preallocated Length", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132899
3538