New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@valjoux/eta

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@valjoux/eta - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

29

dist/index.cjs.js

@@ -5,28 +5,45 @@ 'use strict';

var formatTime = require('@valjoux/format-time');
var presets = require('@palett/presets');
var timestamp = require('@valjoux/timestamp');
var timestampPretty = require('@valjoux/timestamp-pretty');
class Eta {
constructor() {
constructor({
formatter
} = {}) {
this.c = new Date();
this.p = 0;
this.ft = formatter !== null && formatter !== void 0 ? formatter : timestamp.time;
}
tick() {
return this.p = this.c, this.c = new Date(), this.c - this.p;
return this.p = this.c, this.c = new Date();
}
ini(msg = '') {
return `[${formatTime.formatTime(this.c)}] [Ini 0ms] ${msg}`;
return this.tick(), `${this.ft(this.c)} [ini 0ms] ${msg}`;
}
lap(msg = '') {
return `[${formatTime.formatTime(this.c)}] [Lap ${this.tick()}ms] ${msg}`;
return this.tick(), `${this.ft(this.c)} [lap ${this.c - this.p}ms] ${msg}`;
}
end(msg = '') {
return `[${formatTime.formatTime(this.c)}] [End ${this.tick()}ms] ${msg}`;
return this.tick(), `${this.ft(this.c)} [end ${this.c - this.p}ms] ${msg}`;
}
static build() {
return new Eta();
}
static buildPretty(timePreset = presets.SUBTLE, milliPreset = presets.SUBTLE) {
const timestamp = timestampPretty.Timestamp.build(undefined, timePreset, milliPreset);
const formatter = timestamp.time.bind(timestamp);
return new Eta({
formatter
});
}
}
exports.Eta = Eta;

@@ -1,27 +0,44 @@

import { formatTime } from '@valjoux/format-time';
import { SUBTLE } from '@palett/presets';
import { time } from '@valjoux/timestamp';
import { Timestamp } from '@valjoux/timestamp-pretty';
class Eta {
constructor() {
constructor({
formatter
} = {}) {
this.c = new Date();
this.p = 0;
this.ft = formatter !== null && formatter !== void 0 ? formatter : time;
}
tick() {
return this.p = this.c, this.c = new Date(), this.c - this.p;
return this.p = this.c, this.c = new Date();
}
ini(msg = '') {
return `[${formatTime(this.c)}] [Ini 0ms] ${msg}`;
return this.tick(), `${this.ft(this.c)} [ini 0ms] ${msg}`;
}
lap(msg = '') {
return `[${formatTime(this.c)}] [Lap ${this.tick()}ms] ${msg}`;
return this.tick(), `${this.ft(this.c)} [lap ${this.c - this.p}ms] ${msg}`;
}
end(msg = '') {
return `[${formatTime(this.c)}] [End ${this.tick()}ms] ${msg}`;
return this.tick(), `${this.ft(this.c)} [end ${this.c - this.p}ms] ${msg}`;
}
static build() {
return new Eta();
}
static buildPretty(timePreset = SUBTLE, milliPreset = SUBTLE) {
const timestamp = Timestamp.build(undefined, timePreset, milliPreset);
const formatter = timestamp.time.bind(timestamp);
return new Eta({
formatter
});
}
}
export { Eta };
{
"name": "@valjoux/eta",
"version": "0.1.8",
"version": "0.1.9",
"description": "timer",

@@ -18,3 +18,5 @@ "main": "dist/index.cjs.js",

"dependencies": {
"@valjoux/format-time": "^0.1.8"
"@palett/presets": "^0.3.5",
"@valjoux/timestamp": "^0.1.9",
"@valjoux/timestamp-pretty": "^0.1.9"
},

@@ -37,3 +39,3 @@ "repository": {

"homepage": "https://github.com/hoyeungw/valjoux#readme",
"gitHead": "a4749a2ca653eb31ee67137b1046c5eb5abf069d"
"gitHead": "18c8e2185b9200169821e113a80add92e9f18fe0"
}
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