ml-spectra-processing
Advanced tools
Comparing version 5.3.0 to 5.3.1
# Changelog | ||
### [5.3.1](https://www.github.com/mljs/spectra-processing/compare/v5.3.0...v5.3.1) (2021-02-16) | ||
### Bug Fixes | ||
* xAdd/substract/divide/multiply also work with floatarray ([#53](https://www.github.com/mljs/spectra-processing/issues/53)) ([6460573](https://www.github.com/mljs/spectra-processing/commit/6460573974c04387f144faa4d0b7a88ebef9cec4)) | ||
* xMonotone was failing if it started with constant values ([#54](https://www.github.com/mljs/spectra-processing/issues/54)) ([3fbd82b](https://www.github.com/mljs/spectra-processing/commit/3fbd82b9a335724bbada5343e9654836ab769e47)) | ||
## [5.3.0](https://www.github.com/mljs/spectra-processing/compare/v5.2.0...v5.3.0) (2021-02-15) | ||
@@ -4,0 +12,0 @@ |
{ | ||
"name": "ml-spectra-processing", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"description": "Various method to process spectra", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -1,2 +0,2 @@ | ||
/** | ||
import isAnyArray from 'is-any-array'; | ||
@@ -12,3 +12,3 @@ /** | ||
let constant; | ||
if (Array.isArray(array2)) { | ||
if (isAnyArray(array2)) { | ||
if (array1.length !== array2.length) { | ||
@@ -15,0 +15,0 @@ throw new Error('sub: size of array1 and array2 must be identical'); |
@@ -1,2 +0,2 @@ | ||
/** | ||
import isAnyArray from 'is-any-array'; | ||
@@ -12,3 +12,3 @@ /** | ||
let constant; | ||
if (Array.isArray(array2)) { | ||
if (isAnyArray(array2)) { | ||
if (array1.length !== array2.length) { | ||
@@ -15,0 +15,0 @@ throw new Error('sub: size of array1 and array2 must be identical'); |
@@ -7,4 +7,14 @@ /** | ||
export function xIsMonotone(array) { | ||
if (array.length < 3) return true; | ||
if (array[0] < array[1]) { | ||
if (array.length <= 2) { | ||
return true; | ||
} | ||
if (array[0] === array[1]) { | ||
// maybe a constant series | ||
for (let i = 1; i < array.length - 1; i++) { | ||
if (array[i] !== array[i + 1]) return false; | ||
} | ||
return true; | ||
} | ||
if (array[0] < array[array.length - 1]) { | ||
for (let i = 0; i < array.length - 1; i++) { | ||
@@ -11,0 +21,0 @@ if (array[i] >= array[i + 1]) return false; |
@@ -0,4 +1,3 @@ | ||
import isAnyArray from 'is-any-array'; | ||
/** | ||
/** | ||
* This function xMultiply the first array by the second array or a constant value to each element of the first array | ||
@@ -12,3 +11,3 @@ * @param {Array} array1 - the array that will be rotated | ||
let constant; | ||
if (Array.isArray(array2)) { | ||
if (isAnyArray(array2)) { | ||
if (array1.length !== array2.length) { | ||
@@ -15,0 +14,0 @@ throw new Error('sub: size of array1 and array2 must be identical'); |
@@ -0,1 +1,2 @@ | ||
import isAnyArray from 'is-any-array'; | ||
/** | ||
@@ -10,3 +11,3 @@ * This function xSubtract the first array by the second array or a constant value from each element of the first array | ||
let constant; | ||
if (Array.isArray(array2)) { | ||
if (isAnyArray(array2)) { | ||
if (array1.length !== array2.length) { | ||
@@ -13,0 +14,0 @@ throw new Error('sub: size of array1 and array2 must be identical'); |
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
205574
5684