New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

progress-str

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

progress-str

Create a progress string

latest
Source
npmnpm
Version
3.4.4
Version published
Maintainers
1
Created
Source

progress-str

NPM version NPM downloads

GitHub NodeJS Codecov

semantic-release

Visual Studio Code Wallaby.js

Create a string based progress bar.

Usage

import { progressBar } from 'progress-str'

const bar = progressBar()

bar.render(0.5)          // [-----------|-----------] 50%

// Also support multiple values
bar.render(0.25, 0.5, 1) // [---|--|-----|] 25%  50%  100%

// If the value is unknown/not available, pass in undefined:
bar.render(0.5, undefined) // [---------|----------] 0.5 ---

Configure

progressBar({
  bar: {
    completedMarker: '-', // marker for completed section of the bar
    incompleteMarker: '-', // marker for incomplete section of the bar
    leftBracketMarker: '[',
    rightBracketMarker: ']',
  },
  length: 30, // total length of the result, including the text
  textAlign: 'left', // align text relative to max possible text length of each entry.
  textPosition: 'right', // 'left' | 'right' | 'none'
  value: {
    digits: 1, // number of fraction digits. 0 | 1 | 2.
              // It defaults to different values depending on the max value.
    max: 1, // Value that means 100%.
            // It can be set to undefined, to indicate that value is not available.
            // But the render value must also be undefined.
            // If not it will throws MissingMaxValue.
    marker: '|', // marker for the value
    textStyle: 'percentage', // 'percentage' | 'number' | 'ratio'
    textTransform(text: string): string, // transform the styled string, can use this to color the text
  }
})

// To style multiple values differently.
progressBar({
  ...,
  value: [{ ... }, { ... }, ...],
})

FAQs

Package last updated on 17 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts