Socket
Socket
Sign inDemoInstall

pad

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pad - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

7

lib/colors.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 2.0.1
// Generated by CoffeeScript 1.12.7
var pad;

@@ -6,3 +6,6 @@

module.exports = function(string, size, options = {}) {
module.exports = function(string, size, options) {
if (options == null) {
options = {};
}
if (typeof options === 'string') {

@@ -9,0 +12,0 @@ options = {

@@ -1,7 +0,14 @@

// Generated by CoffeeScript 2.0.1
module.exports = function(text, length, options = {}) {
var escapecolor, invert, pad, padlength;
// Generated by CoffeeScript 1.12.7
var wcwidth;
wcwidth = require('wcwidth');
module.exports = function(text, length, options) {
var escapecolor, invert, pad, padlength, ref, textnocolors;
if (options == null) {
options = {};
}
invert = typeof text === 'number';
if (invert) {
[length, text] = [text, length];
ref = [text, length], length = ref[0], text = ref[1];
}

@@ -19,9 +26,12 @@ if (typeof options === 'string') {

}
text = text.toString();
if (typeof text !== 'string') {
text = text.toString();
}
textnocolors = null;
pad = '';
if (options.colors) {
escapecolor = /\x1B\[(?:[0-9]{1,2}(?:;[0-9]{1,2})?)?[m|K]/g;
length += text.length - text.replace(escapecolor, '').length;
textnocolors = text.replace(escapecolor, '');
}
padlength = length - text.length;
padlength = options.fixed_width ? length - (textnocolors || text).length : length - wcwidth(textnocolors || text, options.wcwidth_options);
if (padlength < 0) {

@@ -28,0 +38,0 @@ if (options.strip) {

{
"name": "pad",
"description": "Left and right string padding",
"version": "1.2.0",
"version": "1.2.1",
"author": "David Worms <david@adaltas.com>",

@@ -36,5 +36,5 @@ "contributors": [

"dependencies": {
"coffeescript": "^2.0.1",
"coffee-script": "^1.12.7",
"wcwidth": "^1.0.1"
}
}
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