From 393a4194375d72c4cfa49f7cbc44e1e01c299da4 Mon Sep 17 00:00:00 2001 From: Nikita Volobuev Date: Tue, 30 Oct 2018 18:32:11 +0200 Subject: [PATCH] Fix benchmarking rangeEx --- JavaScript/5-range.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/JavaScript/5-range.js b/JavaScript/5-range.js index c87bc59..fa4e147 100644 --- a/JavaScript/5-range.js +++ b/JavaScript/5-range.js @@ -1,6 +1,8 @@ 'use strict'; const benchmark = require('./2-benchmark.js'); +const common = require('metarhia-common'); +const os = require('os'); const rangePush = (min, max) => { const arr = []; @@ -24,14 +26,14 @@ const rangeEx = range => { const toType = typeof to; if (toType === 'undefined') { to = range[2]; - return api.common.range(from, to); + return common.range(from, to); } else if (toType !== 'number') { let count = to[0]; if (count < 0) { - const cpus = api.os.cpus().length; + const cpus = os.cpus().length; count = cpus + count; } - return api.common.range(from, from + count - 1); + return common.range(from, from + count - 1); } }; @@ -43,6 +45,6 @@ benchmark.do(1000000, [ rangeNew(1, 1000); }, function testRangeEx() { - rangeNew(1, 1000); + rangeEx([1, [1000]]); }, ]); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy