From 5f7248f110f6509d57bb7451fd3817fd4038b33e Mon Sep 17 00:00:00 2001 From: HP Dietz Date: Sat, 20 Feb 2021 17:14:29 +0100 Subject: [PATCH] Translate long form time units in library. --- CHANGELOG.md | 3 +++ docs/js-profiler.1 | 2 +- lib/index.js | 6 ++++++ lib/profile-runner/index.js | 1 - package.json | 2 +- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de2aa62..650a5ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### 2.4.1 +* [#103: Translate long form time units in library.](https://github.com/haensl/js-profiler/issues/103) + ### 2.4.0 * [#103: Add aliases for micro- and milliseconds.](https://github.com/haensl/js-profiler/issues/103) * Update dependencies. diff --git a/docs/js-profiler.1 b/docs/js-profiler.1 index 15582a4..8b58f4b 100644 --- a/docs/js-profiler.1 +++ b/docs/js-profiler.1 @@ -1,5 +1,5 @@ ." vim: set syn=nroff -.TH js-profiler 1 "February 2021" "js-profiler v2.4.0" +.TH js-profiler 1 "February 2021" "js-profiler v2.4.1" .SH NAME js-profiler - A JavaScript profiling tool and collection of profiling modules and benchmarks. diff --git a/lib/index.js b/lib/index.js index 7fe06a3..64430ec 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,5 +1,6 @@ const profiles = require('./profiles'); const DEFAULTS = require('./support/defaults'); +const UNITS = require('./support/units'); const ProfileRunner = require('./profile-runner'); const Reporter = require('./reporter/reporter'); const ConsoleReporter = require('./reporter/console'); @@ -17,6 +18,11 @@ module.exports = { ...DEFAULTS, ...opts }; + + if (UNITS.isAliasForTimeUnit(options.units.time)) { + options.units.time = UNITS.getAliasForTimeUnit(options.units.time); + } + let p = profiles.slice(); if (Array.isArray(options.profiles)) { p = profiles.filter((profile) => diff --git a/lib/profile-runner/index.js b/lib/profile-runner/index.js index 0349ab1..ef43d90 100644 --- a/lib/profile-runner/index.js +++ b/lib/profile-runner/index.js @@ -4,7 +4,6 @@ const EventEmitter = require('events'); const testdata = require('../support/testdata'); const profiler = require('../support/profiler'); const EVENTS = require('../support/events'); -//const UNITS = require('../support/units'); class ProfileRunner extends EventEmitter { /** diff --git a/package.json b/package.json index e5e06d6..9e03948 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "js-profiler", - "version": "2.4.0", + "version": "2.4.1", "description": "Javascript profiling tool and collection of performance profiles for various JavaScript built-ins.", "main": "lib/index.js", "man": "./docs/js-profiler.1.gz",