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

Console with locale timestamp

  • 1.0.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Console with locale timestamp

npm version test status

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.

Sample

JavaScript

import Console from 'console-locale-timestamp';

const console1 = new Console();
console1.debug('Hello World!');
console1.table({
	1001: { name: 'John Smith', age: '20' },
	1002: { name: 'Taro Yamada', age: '25' },
});

const console2 = new Console('en-US', { minute: '2-digit', second: '2-digit' }, ['[', ']'], ' - ');
console2.debug('Hello World!');
console2.table({
	1001: { name: 'John Smith', age: '20' },
	1002: { name: 'Taro Yamada', age: '25' },
});

Console

0:00:00 Hello World!
0:00:01
┌─────────┬───────────────┬──────┐
│ (index) │     name      │ age  │
├─────────┼───────────────┼──────┤
│  1001   │ 'John Smith'  │ '20' │
│  1002   │ 'Taro Yamada' │ '25' │
└─────────┴───────────────┴──────┘
[00:02] - Hello World!
[00:03]
┌─────────┬───────────────┬──────┐
│ (index) │     name      │ age  │
├─────────┼───────────────┼──────┤
│  1001   │ 'John Smith'  │ '20' │
│  1002   │ 'Taro Yamada' │ '25' │
└─────────┴───────────────┴──────┘

Constructor arguments

constructor(locales?: string, options?: object, quote?: string[], separator?: string)
nametypedeaultexampleDescription
localesstringundefined'en-US'The specified value will be used as the first argument of Date.prototype.toLocaleTimeString().
optionsobjectundefined{ minute: '2-digit', second: '2-digit' }The specified value will be used as the second argument of Date.prototype.toLocaleTimeString().
quotestring[]['']['[', ']']The characters that surround the timestamp. If you omit the second value, the same characters as the first are applied.
separatorstring''' - 'Delimiter between the timestamp and the message that follows.

Methods

Keywords

FAQs

Package last updated on 30 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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