unitimer
Advanced tools
Comparing version 3.8.3 to 3.9.0
@@ -7,6 +7,2 @@ module.exports = { | ||
'semi': ['error', 'never'], | ||
'import/named': 'error', | ||
'import/default': 'error', | ||
'import/prefer-default-export': 'off', | ||
'react/require-default-props': 'off', | ||
'no-bitwise': 'off', | ||
@@ -13,0 +9,0 @@ 'no-shadow': 'off' |
{ | ||
"name": "unitimer", | ||
"version": "3.8.3", | ||
"version": "3.9.0", | ||
"description": "Universal timer (Node.js and browser)", | ||
"main": "./lib/index.js", | ||
"source": "src/index.js", | ||
"main": "lib/unitimer.js", | ||
"umd:main": "lib/unitimer.umd.js", | ||
"module": "lib/unitimer.m.js", | ||
"scripts": { | ||
"build": "babel src/ -d lib/", | ||
"watch": "babel -w src/ -d lib/", | ||
"build": "microbundle", | ||
"dev": "microbundle watch", | ||
"lint": "eslint ./src --ext .js", | ||
@@ -60,3 +63,6 @@ "fix": "eslint ./src --ext .js --fix", | ||
"eslint-plugin-import": "^2.2.0", | ||
"microbundle": "^0.4.4", | ||
"proxyquire": "^1.7.10", | ||
"rollup": "^0.59.2", | ||
"rollup-plugin-babel": "^3.0.4", | ||
"sinon": "^2.3.1", | ||
@@ -63,0 +69,0 @@ "watchify": "^3.7.0" |
@@ -1,4 +0,4 @@ | ||
const now = require('./now') | ||
import now from './now' | ||
function toFixed(v, dp) { | ||
const toFixed = (v, dp) => { | ||
if (typeof dp === 'undefined') { | ||
@@ -10,3 +10,3 @@ return v | ||
function createInstance(tag) { | ||
const createInstance = (tag) => { | ||
let totalTime | ||
@@ -20,3 +20,3 @@ let meanTime | ||
function reset() { | ||
const reset = () => { | ||
totalTime = 0 | ||
@@ -96,11 +96,7 @@ meanTime = 0 | ||
function isArray(o) { | ||
return Object.prototype.toString.call(o) === '[object Array]' | ||
} | ||
const isArray = o => Object.prototype.toString.call(o) === '[object Array]' | ||
function isString(o) { | ||
return (typeof o === 'string') || (o instanceof String) | ||
} | ||
const isString = o => (typeof o === 'string') || (o instanceof String) | ||
function createTimer(tags) { | ||
const createTimer = (tags) => { | ||
if (isArray(tags)) { | ||
@@ -119,2 +115,2 @@ const a = [] | ||
module.exports = createTimer | ||
export default createTimer |
@@ -1,8 +0,8 @@ | ||
function now() { | ||
return typeof window.performance !== 'undefined' && | ||
typeof window.performance.now !== 'undefined' | ||
? window.performance.now() | ||
: Date.now() | ||
} | ||
const now = () => ( | ||
typeof window.performance !== 'undefined' && | ||
typeof window.performance.now !== 'undefined' | ||
? window.performance.now() | ||
: Date.now() | ||
) | ||
module.exports = now | ||
export default now |
@@ -1,2 +0,2 @@ | ||
function now() { | ||
const now = () => { | ||
const t = process.hrtime() | ||
@@ -6,2 +6,2 @@ return (t[0] * 1000) + (t[1] / 1000000) | ||
module.exports = now | ||
export default now |
@@ -1,3 +0,3 @@ | ||
const nowNode = require('./now-node') | ||
const nowBrowser = require('./now-browser') | ||
import nowNode from './now-node' | ||
import nowBrowser from './now-browser' | ||
@@ -11,2 +11,2 @@ let now | ||
module.exports = now | ||
export default () => now() |
const test = require('ava') | ||
const sinon = require('sinon') | ||
const createTimer = require('../src') | ||
const createTimer = require('../lib/unitimer') | ||
@@ -5,0 +5,0 @@ function stubHrtime(times) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
234678
19
20
423