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

console-locale-timestamp

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-locale-timestamp - npm Package Compare versions

Comparing version 1.0.14 to 1.0.15

95

dist/ConsoleLocaleTimestamp.d.ts
/**
* Console Locale Timestamp
*
* Provides a console debugging facilities with a timestamp.
* Timestamps are written using `Date.prototype.toLocaleTimeString()`.
* All public methods have the same functionality as the `Console`<https://console.spec.whatwg.org/>.
* Console with locale timestamp
*/

@@ -11,30 +7,17 @@ export default class ConsoleLocaleTimestamp {

/**
* @param {string} locales - The specified value will be used as the first argument of `Date.prototype.toLocaleTimeString()`. (e.g. 'en-US' => '12:00:00 AM', 'ja-JP' => '0:00:00' )
* @param {Intl.DateTimeFormatOptions} options - The specified value will be used as the second argument of `Date.prototype.toLocaleTimeString()`. (e.g. { minute: '2-digit', second: '2-digit' } => '00:00')
* @param {[string, string?]} quote - The characters that surround the timestamp. If you omit the second value, the same characters as the first are applied. (e.g. [''] => '0:00:00' , ['[', ']'] => '[0:00:00]' )
* @param {string} separator - Delimiter between the timestamp and the message that follows. (e.g. ' - ' => '0:00:00 - Log message.' )
* @param locales - The specified value will be used as the first argument of `Date.prototype.toLocaleTimeString()`. (e.g. 'en-US' => '12:00:00 AM', 'ja-JP' => '0:00:00' )
* @param options - The specified value will be used as the second argument of `Date.prototype.toLocaleTimeString()`. (e.g. { minute: '2-digit', second: '2-digit' } => '00:00')
* @param quote - The characters that surround the timestamp. If you omit the second value, the same characters as the first are applied. (e.g. [''] => '0:00:00' , ['[', ']'] => '[0:00:00]' )
* @param separator - Delimiter between the timestamp and the message that follows. (e.g. ' - ' => '0:00:00 - Log message.' )
*/
constructor(locales?: string, options?: Intl.DateTimeFormatOptions, quote?: [string, string?], separator?: string);
/**
* Print a timestamp to the console.
*
* @param {string} logLevel - Grouping name of logLevel
* @param {string} separator - Delimiter between the timestamp and the message that follows
*/
private _printTimestamp;
/**
* Print a timestamp to the console. A line break is performed immediately after the timestamp.
*
* @param {string} logLevel - Grouping name of logLevel
*/
private _printlnTimestamp;
/**
* Wrapper of console.assert()
*
* @param {boolean} condition - First argument of console.assert()
* @param {any[]} data - Second and subsequent arguments of console.assert()
* @param condition - First argument of console.assert()
* @param data - Second and subsequent arguments of console.assert()
*
* @see console.assert() <https://console.spec.whatwg.org/#assert>
*/
assert(condition?: boolean, ...data: any[]): void;
assert(condition?: boolean, ...data: unknown[]): void;
/**

@@ -49,77 +32,77 @@ * Wrapper of console.clear()

*
* @param {any[]} data - Argument of console.debug()
* @param data - Argument of console.debug()
*
* @see console.debug() <https://console.spec.whatwg.org/#debug>
*/
debug(...data: any[]): void;
debug(...data: unknown[]): void;
/**
* Wrapper of console.error()
*
* @param {any[]} data - Argument of console.error()
* @param data - Argument of console.error()
*
* @see console.error() <https://console.spec.whatwg.org/#error>
*/
error(...data: any[]): void;
error(...data: unknown[]): void;
/**
* Wrapper of console.info()
*
* @param {any[]} data - Argument of console.info()
* @param data - Argument of console.info()
*
* @see console.info() <https://console.spec.whatwg.org/#info>
*/
info(...data: any[]): void;
info(...data: unknown[]): void;
/**
* Wrapper of console.log()
*
* @param {any[]} data - Argument of console.log()
* @param data - Argument of console.log()
*
* @see console.log() <https://console.spec.whatwg.org/#log>
*/
log(...data: any[]): void;
log(...data: unknown[]): void;
/**
* Wrapper of console.table()
*
* @param {any} tabularData - First argument of console.table()
* @param {string[]} properties - Second and subsequent arguments of console.table()
* @param tabularData - First argument of console.table()
* @param properties - Second and subsequent arguments of console.table()
*
* @see console.table() <https://console.spec.whatwg.org/#table>
*/
table(tabularData?: any, properties?: string[]): void;
table(tabularData?: unknown, properties?: string[]): void;
/**
* Wrapper of console.trace()
*
* @param {any[]} data - Argument of console.trace()
* @param data - Argument of console.trace()
*
* @see console.trace() <https://console.spec.whatwg.org/#trace>
*/
trace(...data: any[]): void;
trace(...data: unknown[]): void;
/**
* Wrapper of console.warn()
*
* @param {any[]} data - Argument of console.warn()
* @param data - Argument of console.warn()
*
* @see console.warn() <https://console.spec.whatwg.org/#warn>
*/
warn(...data: any[]): void;
warn(...data: unknown[]): void;
/**
* Wrapper of console.dir()
*
* @param {any} item - First argument of console.dir()
* @param {any} options - Second and subsequent arguments of console.dir()
* @param item - First argument of console.dir()
* @param options - Second and subsequent arguments of console.dir()
*
* @see console.dir() <https://console.spec.whatwg.org/#dir>
*/
dir(item?: any, options?: any): void;
dir(item?: unknown, options?: unknown): void;
/**
* Wrapper of console.dirxml()
*
* @param {any[]} data - Argument of console.dirxml()
* @param data - Argument of console.dirxml()
*
* @see console.dirxml() <https://console.spec.whatwg.org/#dirxml>
*/
dirxml(...data: any[]): void;
dirxml(...data: unknown[]): void;
/**
* Wrapper of console.count()
*
* @param {string} label - Argument of console.count()
* @param label - Argument of console.count()
*

@@ -132,3 +115,3 @@ * @see console.count() <https://console.spec.whatwg.org/#count>

*
* @param {string} label - Argument of console.countReset()
* @param label - Argument of console.countReset()
*

@@ -141,15 +124,15 @@ * @see console.countReset() <https://console.spec.whatwg.org/#countreset>

*
* @param {any[]} label - Argument of console.group()
* @param label - Argument of console.group()
*
* @see console.group() <https://console.spec.whatwg.org/#group>
*/
group(...label: any[]): void;
group(...label: unknown[]): void;
/**
* Wrapper of console.groupCollapsed()
*
* @param {any[]} label - Argument of console.groupCollapsed()
* @param label - Argument of console.groupCollapsed()
*
* @see console.groupCollapsed() <https://console.spec.whatwg.org/#groupcollapsed>
*/
groupCollapsed(...label: any[]): void;
groupCollapsed(...label: unknown[]): void;
/**

@@ -164,3 +147,3 @@ * Wrapper of console.groupEnd()

*
* @param {string} label - Argument of console.time()
* @param label - Argument of console.time()
*

@@ -173,12 +156,12 @@ * @see console.time() <https://console.spec.whatwg.org/#time>

*
* @param {string} label - First argument of console.timeLog()
* @param {any[]} data - Second and subsequent arguments of console.timeLog()
* @param label - First argument of console.timeLog()
* @param data - Second and subsequent arguments of console.timeLog()
*
* @see console.timeLog() <https://console.spec.whatwg.org/#timelog>
*/
timeLog(label?: string, ...data: any[]): void;
timeLog(label?: string, ...data: unknown[]): void;
/**
* Wrapper of console.timeEnd()
*
* @param {string} label - Argument of console.timeEnd()
* @param label - Argument of console.timeEnd()
*

@@ -185,0 +168,0 @@ * @see console.timeEnd() <https://console.spec.whatwg.org/#timeend>

/**
* Console Locale Timestamp
*
* Provides a console debugging facilities with a timestamp.
* Timestamps are written using `Date.prototype.toLocaleTimeString()`.
* All public methods have the same functionality as the `Console`<https://console.spec.whatwg.org/>.
* Console with locale timestamp
*/

@@ -21,6 +17,6 @@ export default class ConsoleLocaleTimestamp {

/**
* @param {string} locales - The specified value will be used as the first argument of `Date.prototype.toLocaleTimeString()`. (e.g. 'en-US' => '12:00:00 AM', 'ja-JP' => '0:00:00' )
* @param {Intl.DateTimeFormatOptions} options - The specified value will be used as the second argument of `Date.prototype.toLocaleTimeString()`. (e.g. { minute: '2-digit', second: '2-digit' } => '00:00')
* @param {[string, string?]} quote - The characters that surround the timestamp. If you omit the second value, the same characters as the first are applied. (e.g. [''] => '0:00:00' , ['[', ']'] => '[0:00:00]' )
* @param {string} separator - Delimiter between the timestamp and the message that follows. (e.g. ' - ' => '0:00:00 - Log message.' )
* @param locales - The specified value will be used as the first argument of `Date.prototype.toLocaleTimeString()`. (e.g. 'en-US' => '12:00:00 AM', 'ja-JP' => '0:00:00' )
* @param options - The specified value will be used as the second argument of `Date.prototype.toLocaleTimeString()`. (e.g. { minute: '2-digit', second: '2-digit' } => '00:00')
* @param quote - The characters that surround the timestamp. If you omit the second value, the same characters as the first are applied. (e.g. [''] => '0:00:00' , ['[', ']'] => '[0:00:00]' )
* @param separator - Delimiter between the timestamp and the message that follows. (e.g. ' - ' => '0:00:00 - Log message.' )
*/

@@ -50,2 +46,3 @@ constructor(locales, options, quote, separator) {

}
// eslint-disable-next-line prefer-destructuring
this.#openQuote = quote[0];

@@ -64,6 +61,6 @@ this.#closeQuote = quote.length === 1 ? quote[0] : quote[1];

*
* @param {string} logLevel - Grouping name of logLevel
* @param {string} separator - Delimiter between the timestamp and the message that follows
* @param logLevel - Grouping name of logLevel
* @param separator - Delimiter between the timestamp and the message that follows
*/
_printTimestamp(logLevel, separator = this.#separator) {
#printTimestamp(logLevel, separator = this.#separator) {
const timestamp = `${this.#openQuote}${new Date().toLocaleTimeString(this.#locales, this.#options)}${this.#closeQuote}${separator}`;

@@ -89,6 +86,6 @@ switch (logLevel) {

*
* @param {string} logLevel - Grouping name of logLevel
* @param logLevel - Grouping name of logLevel
*/
_printlnTimestamp(logLevel) {
this._printTimestamp(logLevel, '\n');
#printlnTimestamp(logLevel) {
this.#printTimestamp(logLevel, '\n');
}

@@ -98,4 +95,4 @@ /**

*
* @param {boolean} condition - First argument of console.assert()
* @param {any[]} data - Second and subsequent arguments of console.assert()
* @param condition - First argument of console.assert()
* @param data - Second and subsequent arguments of console.assert()
*

@@ -106,3 +103,3 @@ * @see console.assert() <https://console.spec.whatwg.org/#assert>

if (!condition) {
this._printTimestamp(this.#LOG_LEVEL.error);
this.#printTimestamp(this.#LOG_LEVEL.error);
}

@@ -122,3 +119,3 @@ console.assert(condition, ...data);

*
* @param {any[]} data - Argument of console.debug()
* @param data - Argument of console.debug()
*

@@ -128,3 +125,3 @@ * @see console.debug() <https://console.spec.whatwg.org/#debug>

debug(...data) {
this._printTimestamp(this.#LOG_LEVEL.log);
this.#printTimestamp(this.#LOG_LEVEL.log);
console.debug(...data);

@@ -135,3 +132,3 @@ }

*
* @param {any[]} data - Argument of console.error()
* @param data - Argument of console.error()
*

@@ -141,3 +138,3 @@ * @see console.error() <https://console.spec.whatwg.org/#error>

error(...data) {
this._printTimestamp(this.#LOG_LEVEL.error);
this.#printTimestamp(this.#LOG_LEVEL.error);
console.error(...data);

@@ -148,3 +145,3 @@ }

*
* @param {any[]} data - Argument of console.info()
* @param data - Argument of console.info()
*

@@ -154,3 +151,3 @@ * @see console.info() <https://console.spec.whatwg.org/#info>

info(...data) {
this._printTimestamp(this.#LOG_LEVEL.info);
this.#printTimestamp(this.#LOG_LEVEL.info);
console.info(...data);

@@ -161,3 +158,3 @@ }

*
* @param {any[]} data - Argument of console.log()
* @param data - Argument of console.log()
*

@@ -167,3 +164,3 @@ * @see console.log() <https://console.spec.whatwg.org/#log>

log(...data) {
this._printTimestamp(this.#LOG_LEVEL.log);
this.#printTimestamp(this.#LOG_LEVEL.log);
console.log(...data);

@@ -174,4 +171,4 @@ }

*
* @param {any} tabularData - First argument of console.table()
* @param {string[]} properties - Second and subsequent arguments of console.table()
* @param tabularData - First argument of console.table()
* @param properties - Second and subsequent arguments of console.table()
*

@@ -181,3 +178,3 @@ * @see console.table() <https://console.spec.whatwg.org/#table>

table(tabularData, properties) {
this._printlnTimestamp(this.#LOG_LEVEL.log);
this.#printlnTimestamp(this.#LOG_LEVEL.log);
console.table(tabularData, properties);

@@ -188,3 +185,3 @@ }

*
* @param {any[]} data - Argument of console.trace()
* @param data - Argument of console.trace()
*

@@ -194,3 +191,3 @@ * @see console.trace() <https://console.spec.whatwg.org/#trace>

trace(...data) {
this._printTimestamp(this.#LOG_LEVEL.log);
this.#printTimestamp(this.#LOG_LEVEL.log);
console.trace(...data);

@@ -201,3 +198,3 @@ }

*
* @param {any[]} data - Argument of console.warn()
* @param data - Argument of console.warn()
*

@@ -207,3 +204,3 @@ * @see console.warn() <https://console.spec.whatwg.org/#warn>

warn(...data) {
this._printTimestamp(this.#LOG_LEVEL.warn);
this.#printTimestamp(this.#LOG_LEVEL.warn);
console.warn(...data);

@@ -214,4 +211,4 @@ }

*
* @param {any} item - First argument of console.dir()
* @param {any} options - Second and subsequent arguments of console.dir()
* @param item - First argument of console.dir()
* @param options - Second and subsequent arguments of console.dir()
*

@@ -221,3 +218,3 @@ * @see console.dir() <https://console.spec.whatwg.org/#dir>

dir(item, options) {
this._printTimestamp(this.#LOG_LEVEL.log);
this.#printTimestamp(this.#LOG_LEVEL.log);
console.dir(item, options);

@@ -228,3 +225,3 @@ }

*
* @param {any[]} data - Argument of console.dirxml()
* @param data - Argument of console.dirxml()
*

@@ -234,3 +231,3 @@ * @see console.dirxml() <https://console.spec.whatwg.org/#dirxml>

dirxml(...data) {
this._printTimestamp(this.#LOG_LEVEL.log);
this.#printTimestamp(this.#LOG_LEVEL.log);
console.dirxml(...data);

@@ -241,3 +238,3 @@ }

*
* @param {string} label - Argument of console.count()
* @param label - Argument of console.count()
*

@@ -247,3 +244,3 @@ * @see console.count() <https://console.spec.whatwg.org/#count>

count(label) {
this._printTimestamp(this.#LOG_LEVEL.info);
this.#printTimestamp(this.#LOG_LEVEL.info);
console.count(label);

@@ -254,3 +251,3 @@ }

*
* @param {string} label - Argument of console.countReset()
* @param label - Argument of console.countReset()
*

@@ -265,3 +262,3 @@ * @see console.countReset() <https://console.spec.whatwg.org/#countreset>

*
* @param {any[]} label - Argument of console.group()
* @param label - Argument of console.group()
*

@@ -272,3 +269,3 @@ * @see console.group() <https://console.spec.whatwg.org/#group>

if (label.length > 0) {
this._printTimestamp(this.#LOG_LEVEL.log);
this.#printTimestamp(this.#LOG_LEVEL.log);
}

@@ -280,3 +277,3 @@ console.group(...label);

*
* @param {any[]} label - Argument of console.groupCollapsed()
* @param label - Argument of console.groupCollapsed()
*

@@ -287,3 +284,3 @@ * @see console.groupCollapsed() <https://console.spec.whatwg.org/#groupcollapsed>

if (label.length > 0) {
this._printTimestamp(this.#LOG_LEVEL.log);
this.#printTimestamp(this.#LOG_LEVEL.log);
}

@@ -303,3 +300,3 @@ console.groupCollapsed(...label);

*
* @param {string} label - Argument of console.time()
* @param label - Argument of console.time()
*

@@ -314,4 +311,4 @@ * @see console.time() <https://console.spec.whatwg.org/#time>

*
* @param {string} label - First argument of console.timeLog()
* @param {any[]} data - Second and subsequent arguments of console.timeLog()
* @param label - First argument of console.timeLog()
* @param data - Second and subsequent arguments of console.timeLog()
*

@@ -321,3 +318,3 @@ * @see console.timeLog() <https://console.spec.whatwg.org/#timelog>

timeLog(label, ...data) {
this._printTimestamp(this.#LOG_LEVEL.log);
this.#printTimestamp(this.#LOG_LEVEL.log);
console.timeLog(label, ...data);

@@ -328,3 +325,3 @@ }

*
* @param {string} label - Argument of console.timeEnd()
* @param label - Argument of console.timeEnd()
*

@@ -334,3 +331,3 @@ * @see console.timeEnd() <https://console.spec.whatwg.org/#timeend>

timeEnd(label) {
this._printTimestamp(this.#LOG_LEVEL.info);
this.#printTimestamp(this.#LOG_LEVEL.info);
console.timeEnd(label);

@@ -337,0 +334,0 @@ }

{
"name": "console-locale-timestamp",
"version": "1.0.14",
"description": "Provides a console debugging facilities with a timestamp. Timestamps are written using `Date.prototype.toLocaleTimeString()`.",
"version": "1.0.15",
"description": "Console with locale timestamp",
"keywords": [
"console"
],
"homepage": "https://github.com/SaekiTominaga/console-locale-timestamp#readme",
"homepage": "https://github.com/SaekiTominaga/npm#readme",
"bugs": {
"url": "https://github.com/SaekiTominaga/console-locale-timestamp/issues"
"url": "https://github.com/SaekiTominaga/npm/issues"
},

@@ -23,3 +23,3 @@ "license": "MIT",

"type": "git",
"url": "git+https://github.com/SaekiTominaga/console-locale-timestamp.git"
"url": "git+https://github.com/SaekiTominaga/npm.git"
},

@@ -30,17 +30,5 @@ "scripts": {

"sample": "node sample.js",
"test": "jest --coverage"
"lint": "eslint src/*.ts __tests__/*.js",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest -c ../../jest.config.mjs --coverage --roots packages/console-locale-timestamp"
},
"devDependencies": {
"@types/jest": "^29.2.0",
"@types/node": "^18.11.7",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"coveralls": "^3.1.1",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jsdoc": "^39.4.0",
"jest": "^29.2.2",
"ts-jest": "^29.0.3",
"typescript": "^4.8.4"
},
"publishConfig": {

@@ -47,0 +35,0 @@ "access": "public"

@@ -1,6 +0,5 @@

# Console Locale Timestamp
# Console with locale timestamp
[![npm version](https://badge.fury.io/js/console-locale-timestamp.svg)](https://badge.fury.io/js/console-locale-timestamp)
[![Build Status](https://github.com/SaekiTominaga/console-locale-timestamp/actions/workflows/test.yml/badge.svg)](https://github.com/SaekiTominaga/console-locale-timestamp/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/SaekiTominaga/console-locale-timestamp/badge.svg)](https://coveralls.io/github/SaekiTominaga/console-locale-timestamp)
[![npm version](https://badge.fury.io/js/console-locale-timestamp.svg)](https://www.npmjs.com/package/console-locale-timestamp)
[![test status](https://github.com/SaekiTominaga/npm/actions/workflows/console-locale-timestamp-test.yml/badge.svg)](https://github.com/SaekiTominaga/npm/actions/workflows/console-locale-timestamp-test.yml)

@@ -7,0 +6,0 @@ Provides a console debugging facilities with a timestamp. Timestamps are written using `Date.prototype.toLocaleTimeString()`.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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