Socket
Socket
Sign inDemoInstall

pad

Package Overview
Dependencies
3
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.0 to 3.0.0

dist/pad.cjs.js

9

CHANGELOG.md
# Changelog
## Version 3.0.0
Backward incompatibility:
* bundles: exported modules are no longer in lib but in dist
* api: remove the colors module, use directly the option instead
New feature:
* dist: generate cjs, esm and umd bundles
## Version 2.3.0

@@ -5,0 +14,0 @@

2

lib/index.d.ts

@@ -9,3 +9,3 @@ // Type definitions for pad 1.1

/** left pad */
/** Left pad */
declare function pad(length: number, text: string, char?: string): string;

@@ -12,0 +12,0 @@ // tslint:disable-next-line unified-signatures

@@ -1,8 +0,8 @@

// Generated by CoffeeScript 2.4.0
var wcwidth;
// Generated by CoffeeScript 2.4.1
var pad;
wcwidth = require('wcwidth');
import * as wcwidth from 'wcwidth';
module.exports = function(text, length, options) {
var escapecolor, invert, pad, padlength, textnocolors;
pad = function(text, length, options) {
var escapecolor, invert, padlength, textnocolors;
if (options == null) {

@@ -53,1 +53,3 @@ options = {};

};
export default pad;
{
"name": "pad",
"description": "Left and right string padding",
"version": "2.3.0",
"version": "3.0.0",
"author": "David Worms <david@adaltas.com>",

@@ -18,2 +18,4 @@ "contributors": [

"mocha": "^6.0.2",
"rollup": "^1.9.0",
"rollup-plugin-babel": "^4.3.2",
"should": "^13.2.3"

@@ -33,3 +35,4 @@ },

"license": "BSD-3-Clause",
"main": "./lib",
"main": "dist/pad.cjs.js",
"module": "dist/pad.esm.js",
"repository": {

@@ -46,4 +49,4 @@ "type": "git",

"major": "npm version major -m 'Bump to version %s'",
"coffee": "coffee -b -o lib src && cd lib && babel *.js -d es5 && cd ..",
"pretest": "coffee -b -o lib src && cd lib && babel *.js -d es5 && cd ..",
"build": "coffee -b -o lib src && rollup -c",
"pretest": "npm run build",
"test": "mocha test/**/*.coffee"

@@ -50,0 +53,0 @@ },

@@ -20,13 +20,31 @@

For TypeScript users, the type definition file is located in "./lib/index.d.ts"
and declared inside the "package.json" file.
For TypeScript users, the type definition files are located in "./lib/index.d.ts" and declared inside the "package.json" file.
This package is written for ES6 supported by Node.js version 7.5 and above. For
older browsers or older versions of Node.js, use the modules inside "./lib/es5".
## Bundles
```javascript
const pad = require('pad/lib/es5')
pad('pad', 5) // "pad "
Node Pad comes in multiple flavours depending on your target environment:
* CommonJS: `dist/pad.cjs.js`
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.
* ES module: `dist/pad.esm.js`
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/).
* UMD: `dis/pad.umd.js`
Bundle in the Universal Module Definition (UMD), a format compatible with both AMD and CommonJS.
The CommonJS syntax to import Node Pad is:
```js
const pad = require("pad/dist/pad.cjs.js")
// Or simply
const pad = require("pad")
```
While the ES Modules syntax is:
```js
import pad from "pad/dist/pad.esm.js"
// Or for ESM-aware tools
import pad from "pad"
```
## Options

@@ -40,10 +58,7 @@

* `colors` (boolean)
Ajust to hidden terminal color characters, you may also use
`require 'pad/lib/colors'` to avoid passing this option.
Ajust to hidden terminal color characters, you may also use `require 'pad/lib/colors'` to avoid passing this option.
* `strip` (boolean)
Remove characters from text if length smaller than text length, default to
"false".
Remove characters from text if length smaller than text length, default to "false".
* `fixed_width` (boolean)
An optimization option to disable the usage of the wcwdith package to handle
the discovery of characters using more than one column for display.
An optimization option to disable the usage of the wcwdith package to handle the discovery of characters using more than one column for display.
one column to display

@@ -50,0 +65,0 @@ * `wcwidth_options` (object)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc