fast-median
Advanced tools
Comparing version 1.0.2 to 1.1.0
'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -15,13 +15,15 @@ var _kthSmallest = require('kth-smallest'); | ||
function median(nums) { | ||
if (!Array.isArray(nums)) { | ||
throw new TypeError('nums should be array, got ' + (typeof nums === 'undefined' ? 'undefined' : _typeof(nums))); | ||
} | ||
function median(nums, noForceCheck) { | ||
if (!noForceCheck) { | ||
if (!Array.isArray(nums)) { | ||
throw new TypeError('nums should be array, got ' + (typeof nums === 'undefined' ? 'undefined' : _typeof(nums))); | ||
} | ||
if (!nums.every(_isNumber2.default)) { | ||
throw new TypeError('nums array must contain only numbers'); | ||
} | ||
if (!nums.every(_isNumber2.default)) { | ||
throw new TypeError('nums array must contain only numbers'); | ||
} | ||
if (nums.length === 0) { | ||
return undefined; | ||
if (nums.length === 0) { | ||
return undefined; | ||
} | ||
} | ||
@@ -28,0 +30,0 @@ |
{ | ||
"name": "fast-median", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Find median of an array in amortized linear time", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
6449
10
90