{"name":"pad","description":"Left and right string padding","version":"3.3.0","author":{"name":"David Worms","email":"david@adaltas.com","url":"https://www.adaltas.com"},"contributors":[],"devDependencies":{"@commitlint/cli":"^19.5.0","@commitlint/config-conventional":"^19.5.0","@eslint/core":"^0.6.0","@eslint/js":"^9.11.1","@rollup/plugin-commonjs":"^28.0.0","@rollup/plugin-node-resolve":"^15.3.0","@rollup/plugin-terser":"^0.4.4","@types/eslint__js":"^8.42.3","@types/mocha":"^10.0.8","@types/node":"^22.7.4","@types/should":"^13.0.0","coffeescript":"^2.7.0","eslint":"^9.11.1","eslint-config-prettier":"^9.1.0","eslint-plugin-mocha":"^10.5.0","eslint-plugin-prettier":"^5.2.1","husky":"^9.1.6","lint-staged":"^15.2.10","mocha":"^10.7.3","prettier":"^3.3.3","rollup":"^4.22.5","rollup-plugin-commonjs":"^10.0.0","rollup-plugin-delete":"^2.1.0","rollup-plugin-dts":"^6.1.1","rollup-plugin-node-resolve":"^5.0.0","rollup-plugin-typescript2":"^0.36.0","should":"^13.2.3","standard-version":"^9.5.0","ts-node":"^10.9.2","typescript":"^5.6.2","typescript-eslint":"^8.7.0"},"dependencies":{"wcwidth":"^1.0.1"},"optionalDependencies":{"@rollup/rollup-linux-x64-gnu":"4.9.5"},"engines":{"node":">= 4.0.0"},"exports":{".":{"import":"./dist/esm/index.js","types":"./dist/types/index.d.ts","require":"./dist/cjs/index.cjs"}},"homepage":"https://github.com/adaltas/node-pad","keywords":["pad","string"],"license":"BSD-3-Clause","lint-staged":{"*.js":"npm run lint:fix","*.md":"prettier -w"},"mocha":{"inline-diffs":true,"loader":"ts-node/esm","recursive":true,"reporter":"spec","require":["should"],"throw-deprecation":false,"timeout":40000},"module":"dist/pad.esm.js","repository":{"type":"git","url":"git+https://github.com/adaltas/node-pad.git"},"scripts":{"build":"rollup -c","lint:check":"eslint","lint:fix":"eslint --fix","lint:staged":"npx lint-staged","release":"standard-version","release:minor":"standard-version --release-as minor","release:patch":"standard-version --release-as patch","release:major":"standard-version --release-as major","postrelease":"git push --follow-tags origin master","test":"mocha test/*.{js,ts}","prepare":"husky install"},"type":"module","_id":"pad@3.3.0","gitHead":"8d2c35180ed558de8cd7a3ee101c4e10f1b1f057","bugs":{"url":"https://github.com/adaltas/node-pad/issues"},"_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-2/G2Q8J/lbkJ3Zf595U9jattrUkM1rwTr3s4n9smp3+ALe66V+t3I75SG0qjWzuQgmXOgiUS0/qE97S+0hP7Cw==","shasum":"364c264ba0b1600468d85db1b8ddb9b522522d70","tarball":"http://registry-npm.ywwl.com/pad/download/pad-3.3.0.tgz","fileCount":8,"unpackedSize":59833,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFvJZBXkrzIw6LjcKUGPCQWiOZu+vDD+BQvoSD9pcDITAiEAgMn+sHQn4LuK49jnQ18C6HsnxO3WdsI34Pptk5Ozhq4="}],"size":13153,"noattachment":false,"key":"/pad/-/pad-3.3.0.tgz"},"_npmUser":{"name":"david","email":"david@adaltas.com"},"directories":{},"maintainers":[{"name":"david","email":"david@adaltas.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pad_3.3.0_1727572083507_0.2936202252551656"},"_hasShrinkwrap":false,"readme":"# Node.js pad\n\n[![Build Status](https://secure.travis-ci.org/adaltas/node-pad.png)](http://travis-ci.org/adaltas/node-pad)\n\nNode Pad is a simple and elegant function to pad strings in both left and right directions. It is written in Typescript and it support both CommonJS and ESM.\n\n## Usage\n\nThe API is quite simple:\n\n```javascript\nimport pad from \"pad\";\n// Or const pad = require(\"pad\")\npad(\"pad\", 5); // \"pad  \"\npad(5, \"pad\"); // \"  pad\"\npad(\"pad\", 5, \"+\"); // \"pad++\"\npad(5, \"pad\", \"+\"); // \"++pad\"\n```\n\nFor TypeScript users, the type definition files are located in \"./lib/index.d.ts\" and declared inside the \"package.json\" file.\n\n## Bundles\n\nNode Pad comes in multiple flavours depending on your target environment:\n\n- CommonJS: `dist/pad.cjs.js`  \n  Bundle used by Node.js and compatible with ES5. It is declared inside the `package.json` by the `main` property and used by default with `require(\"pad\")` in a Node.js environment.\n- ES module: `dist/pad.esm.js`  \n  Bundle using the ECMAScript standard defined in ES6 for working with modules. The path to the ES module is declared inside the `package.json` by the `module` property for ESM-aware tools like [Rollup](https://rollupjs.org) and [webpack 2+](https://webpack.js.org/).\n\nThe CommonJS syntax to import Node Pad is:\n\n```js\nconst pad = require(\"pad/dist/pad.cjs.js\");\n// Or simply\nconst pad = require(\"pad\");\n```\n\nWhile the ES Modules syntax is:\n\n```js\nimport pad from \"pad/dist/pad.esm.js\";\n// Or for ESM-aware tools\nimport pad from \"pad\";\n```\n\n## Options\n\nOptions are provided as a third argument and are all optional. A string argument\nit is interpreted as the \"char\" option. Accepted options include:\n\n- `char` (string)  \n  The character used to fill the gap.\n- `colors` (boolean)  \n  Ajust to hidden terminal color characters, you may also use `require 'pad/lib/colors'` to avoid passing this option.\n- `strip` (boolean)  \n  Remove characters from text if length smaller than text length, default to \"false\".\n- `fixed_width` (boolean)  \n  An optimization option to disable the usage of the wcwdith package to handle the discovery of characters using more than one column for display.\n  one column to display\n- `wcwidth_options` (object)  \n  Options passed to the wcwidth package used to calculate the display width of\n  characters using more than one column.\n\n## Left padding: `pad(length, text, [options])`\n\nLeft padding occurs when the first argument is a number and the second\nargument is a string.\n\n```javascript\nimport pad from \"pad\";\npad(5, \"pad\", \"-\").should.eql(\"--pad\");\n```\n\n## Right padding: `pad(text, length, [options])`\n\nRight padding occurs when the first argument is a string and the second\nargument is a number.\n\n```javascript\nimport pad from \"pad\";\npad(\"pad\", 6).should.eql(\"pad   \");\n```\n\n## Installing\n\nStarting with version 1.1.0, Node pad rely on Node.js 4.0.0 or more recent.\nStick to version 1.0.x if using an older version of Node.js.\n\nVia [npm](http://github.com/isaacs/npm):\n\n```bash\nnpm install pad\n```\n\nVia git (or downloaded tarball), copy or link the project from a discoverable\nNode.js directory:\n\n```bash\ngit clone http://github.com/adaltas/node-pad.git\n```\n\n## Testing\n\nClone the repo, install the development dependencies and run the suite:\n\n```bash\ngit clone http://github.com/adaltas/node-pad.git .\nnpm install\nmake test\n```\n\n## Contributors\n\nThe project is sponsored by [Adaltas](https://www.adaltas.com) based in Paris, France. Adaltas offers support and consulting on distributed systems, big data and open source.\n","publish_time":1727572083764,"_cnpm_publish_time":1727572083764,"dist-tags":{"latest":"3.3.0"}}