Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-median

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-median - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

bench.js

22

lib/index.js
'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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc