uawdijnntqw1x1x1
IP : 216.73.216.86
Hostname : 6.87.74.97.host.secureserver.net
Kernel : Linux 6.87.74.97.host.secureserver.net 4.18.0-553.83.1.el8_10.x86_64 #1 SMP Mon Nov 10 04:22:44 EST 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
emeraadmin
/
www
/
uploads
/
..
/
node_modules
/
object.defaults
/
..
/
..
/
src
/
..
/
4d695
/
cli-columns.tar
/
/
package.json000064400000002557151701430150007040 0ustar00{ "_id": "cli-columns@4.0.0", "_inBundle": true, "_location": "/npm/cli-columns", "_phantomChildren": {}, "_requiredBy": [ "/npm" ], "author": { "name": "Shannon Moeller", "email": "me@shannonmoeller", "url": "http://shannonmoeller.com" }, "bugs": { "url": "https://github.com/shannonmoeller/cli-columns/issues" }, "dependencies": { "string-width": "^4.2.3", "strip-ansi": "^6.0.1" }, "description": "Columnated lists for the CLI.", "devDependencies": { "chalk": "^4.1.2" }, "engines": { "node": ">= 10" }, "eslintConfig": { "extends": "eslint:recommended", "env": { "node": true }, "parserOptions": { "ecmaVersion": 8 } }, "files": [ "*.js" ], "homepage": "https://github.com/shannonmoeller/cli-columns#readme", "keywords": [ "ansi", "cli", "column", "columnate", "columns", "grid", "list", "log", "ls", "row", "rows", "unicode", "unix" ], "license": "MIT", "main": "index.js", "name": "cli-columns", "prettier": { "singleQuote": true }, "repository": { "type": "git", "url": "git+https://github.com/shannonmoeller/cli-columns.git" }, "scripts": { "lint": "npx eslint --fix '*.js' && npx prettier --write '*.js'", "test": "node test.js && node color.js" }, "version": "4.0.0" } test.js000064400000004240151701430150006056 0ustar00'use strict'; const assert = require('assert'); const chalk = require('chalk'); const stripAnsi = require('strip-ansi'); const columns = require('./index.js'); const tests = []; function test(msg, fn) { tests.push([msg, fn]); } process.nextTick(async function run() { for (const [msg, fn] of tests) { try { await fn(assert); console.log(`pass - ${msg}`); } catch (error) { console.error(`fail - ${msg}`, error); process.exit(1); } } }); // prettier-ignore test('should print one column list', t => { const cols = columns(['foo', ['bar', 'baz'], ['bar', 'qux']], { width: 1 }); const expected = 'bar\n' + 'bar\n' + 'baz\n' + 'foo\n' + 'qux'; t.equal(cols, expected); }); // prettier-ignore test('should print three column list', t => { const cols = columns(['foo', ['bar', 'baz'], ['bat', 'qux']], { width: 16 }); const expected = 'bar baz qux \n' + 'bat foo '; t.equal(cols, expected); }); // prettier-ignore test('should print complex list', t => { const cols = columns( [ 'foo', 'bar', 'baz', chalk.cyan('嶜憃撊') + ' 噾噿嚁', 'blue' + chalk.bgBlue('berry'), chalk.red('apple'), 'pomegranate', 'durian', chalk.green('star fruit'), 'apricot', 'banana pineapple' ], { width: 80 } ); const expected = 'apple bar durian star fruit \n' + 'apricot baz foo 嶜憃撊 噾噿嚁 \n' + 'banana pineapple blueberry pomegranate '; t.equal(stripAnsi(cols), expected); }); // prettier-ignore test('should optionally not sort', t => { const cols = columns( [ 'foo', 'bar', 'baz', chalk.cyan('嶜憃撊') + ' 噾噿嚁', 'blue' + chalk.bgBlue('berry'), chalk.red('apple'), 'pomegranate', 'durian', chalk.green('star fruit'), 'apricot', 'banana pineapple' ], { sort: false, width: 80 } ); const expected = 'foo 嶜憃撊 噾噿嚁 pomegranate apricot \n' + 'bar blueberry durian banana pineapple \n' + 'baz apple star fruit '; t.equal(stripAnsi(cols), expected); }); color.js000064400000000623151701430150006216 0ustar00const chalk = require('chalk'); const columns = require('.'); // prettier-ignore const values = [ 'blue' + chalk.bgBlue('berry'), '笔菠萝' + chalk.yellow('苹果笔'), chalk.red('apple'), 'pomegranate', 'durian', chalk.green('star fruit'), 'パイナップル', 'apricot', 'banana', 'pineapple', chalk.bgRed.yellow('orange') ]; console.log(''); console.log(columns(values)); console.log(''); index.js000064400000003133151701430150006206 0ustar00'use strict'; const stringWidth = require('string-width'); const stripAnsi = require('strip-ansi'); const concat = Array.prototype.concat; const defaults = { character: ' ', newline: '\n', padding: 2, sort: true, width: 0, }; function byPlainText(a, b) { const plainA = stripAnsi(a); const plainB = stripAnsi(b); if (plainA === plainB) { return 0; } if (plainA > plainB) { return 1; } return -1; } function makeArray() { return []; } function makeList(count) { return Array.apply(null, Array(count)); } function padCell(fullWidth, character, value) { const valueWidth = stringWidth(value); const filler = makeList(fullWidth - valueWidth + 1); return value + filler.join(character); } function toRows(rows, cell, i) { rows[i % rows.length].push(cell); return rows; } function toString(arr) { return arr.join(''); } function columns(values, options) { values = concat.apply([], values); options = Object.assign({}, defaults, options); let cells = values.filter(Boolean).map(String); if (options.sort !== false) { cells = cells.sort(byPlainText); } const termWidth = options.width || process.stdout.columns; const cellWidth = Math.max.apply(null, cells.map(stringWidth)) + options.padding; const columnCount = Math.floor(termWidth / cellWidth) || 1; const rowCount = Math.ceil(cells.length / columnCount) || 1; if (columnCount === 1) { return cells.join(options.newline); } return cells .map(padCell.bind(null, cellWidth, options.character)) .reduce(toRows, makeList(rowCount).map(makeArray)) .map(toString) .join(options.newline); } module.exports = columns; license000064400000002142151701430150006105 0ustar00The MIT License (MIT) Copyright (c) Shannon Moeller <me@shannonmoeller.com> (shannonmoeller.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/home/emeraadmin/www/uploads/../node_modules/object.defaults/../../src/../4d695/cli-columns.tar