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

gracelog

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gracelog - npm Package Compare versions

Comparing version 0.1.21 to 0.2.0

20

CHANGELOG.md
# Change log
## Version 0.2.0
## Added
#### new dependency wcwidth added
## Changed
#### The character length issue with multibyte characters for .table() fixed
## Deprecated
None
## Removed
None
***
## Version 0.1.21

@@ -4,0 +24,0 @@

21

lib/table.js
var paddings = 2;
var indexName = '(index)';
var wcwidth = require('wcwidth');

@@ -59,3 +60,3 @@ function Table(obj) {

data = data.toString();
var diff = this.longests[index] - charLen(data);
var diff = this.longests[index] - wcwidth(data);

@@ -130,3 +131,3 @@ if (diff) {

Table.prototype.setLongest = function (index, str) {
var len = charLen(str.toString());
var len = wcwidth(str.toString());
if (!this.longests[index] || len > this.longests[index]) {

@@ -137,18 +138,2 @@ this.longests[index] = len;

function charLen(str) {
var length = 0;
for (var i = 0, len = str.length; i < len; i++) {
var bytes = Buffer.byteLength(str[i]);
if (bytes > 2) {
// Eastern Asian languages seem to occupy more than 2 bytes and have wider width
length += 2;
} else {
length += 1;
}
}
return length;
}
module.exports = Table;
{
"name": "gracelog",
"description": "Log management module",
"version": "0.1.21",
"version": "0.2.0",
"author": "Nobuyori Takahashi <voltrue2@yahoo.com>",

@@ -11,3 +11,4 @@ "repository": {

"dependencies": {
"async": "0.9.0"
"async": "0.9.0",
"wcwidth": "1.0.0"
},

@@ -14,0 +15,0 @@ "devDependencies": {

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