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

lpad-align

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lpad-align - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

38

cli.js
#!/usr/bin/env node
'use strict';
const getStdin = require('get-stdin');
const meow = require('meow');
const lpadAlign = require('.');
var getStdin = require('get-stdin');
var meow = require('meow');
var lpadAlign = require('./');
const cli = meow(`
Usage
$ cat <file> | lpad-align
Example
$ cat unicorn.txt | lpad-align
foo
foobar
foobarcat
`, {
var cli = meow({
help: [
'Usage',
' $ cat <file> | lpad-align',
'',
'Example',
' $ cat unicorn.txt | lpad-align',
' foo',
' foobar',
' foobarcat'
]
}, {
default: {

@@ -22,8 +24,8 @@ indent: 4

getStdin().then(data => {
const arr = data.split(/\r?\n/);
getStdin(function (data) {
var arr = data.split(/\r?\n/);
for (const x of arr) {
console.log(lpadAlign(x, arr, cli.flags.indent));
}
arr.forEach(function (el) {
console.log(lpadAlign(el, arr, cli.flags.indent));
});
});
'use strict';
const indentString = require('indent-string');
const longest = require('longest');
var indentString = require('indent-string');
var longest = require('longest');
module.exports = (str, arr, indent) => {
const pad = typeof indent === 'number' ? indent : 0;
module.exports = function (str, arr, indent) {
var pad = typeof indent === 'number' ? indent : 0;
if (typeof str !== 'string') {
throw new TypeError(`Expected a \`string\`, got \`${typeof str}\``);
throw new TypeError('Expected a `string`, got `' + typeof str + '`');
}
if (!Array.isArray(arr)) {
throw new TypeError(`Expected an \`Array\`, got \`${typeof arr}\``);
throw new TypeError('Expected an `Array`, got `' + typeof arr + '`');
}
return indentString(str, pad + longest(arr).length - str.length);
return indentString(str, ' ', pad + longest(arr).length - str.length);
};
{
"name": "lpad-align",
"version": "1.1.1",
"version": "1.1.2",
"description": "Left pad a string to align with the longest string in an array",

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

"engines": {
"node": ">=4"
"node": ">=0.10.0"
},

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

"dependencies": {
"get-stdin": "^5.0.1",
"indent-string": "^3.0.0",
"longest": "^2.0.0",
"lpad": "^2.0.1",
"get-stdin": "^4.0.1",
"indent-string": "^2.1.0",
"longest": "^1.0.0",
"meow": "^3.3.0"

@@ -36,0 +35,0 @@ },

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