Comparing version 1.2.0 to 1.2.1
@@ -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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6865
71
+ Addedcoffee-script@^1.12.7
+ Addedcoffee-script@1.12.7(transitive)
- Removedcoffeescript@^2.0.1
- Removedcoffeescript@2.7.0(transitive)