summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/node-gyp/node_modules/npmlog/node_modules/ansi/examples/progress/index.js
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2016-09-22 07:59:37 -0700
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2016-09-27 16:39:27 -0400
commitd44a9eb11b34900b44a9d135a2c965346fff702e (patch)
treea8d074826fb51641f5a7f24978e5e632b958ca84 /deps/npm/node_modules/node-gyp/node_modules/npmlog/node_modules/ansi/examples/progress/index.js
parent33aa953f918f624a44e538baf2a3ee41570ac303 (diff)
downloadandroid-node-v8-d44a9eb11b34900b44a9d135a2c965346fff702e.tar.gz
android-node-v8-d44a9eb11b34900b44a9d135a2c965346fff702e.tar.bz2
android-node-v8-d44a9eb11b34900b44a9d135a2c965346fff702e.zip
deps: upgrade npm to 3.10.8
PR-URL: https://github.com/nodejs/node/pull/8706 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/node_modules/node-gyp/node_modules/npmlog/node_modules/ansi/examples/progress/index.js')
-rw-r--r--deps/npm/node_modules/node-gyp/node_modules/npmlog/node_modules/ansi/examples/progress/index.js87
1 files changed, 0 insertions, 87 deletions
diff --git a/deps/npm/node_modules/node-gyp/node_modules/npmlog/node_modules/ansi/examples/progress/index.js b/deps/npm/node_modules/node-gyp/node_modules/npmlog/node_modules/ansi/examples/progress/index.js
deleted file mode 100644
index d28dbda27f..0000000000
--- a/deps/npm/node_modules/node-gyp/node_modules/npmlog/node_modules/ansi/examples/progress/index.js
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env node
-
-var assert = require('assert')
- , ansi = require('../../')
-
-function Progress (stream, width) {
- this.cursor = ansi(stream)
- this.delta = this.cursor.newlines
- this.width = width | 0 || 10
- this.open = '['
- this.close = ']'
- this.complete = '█'
- this.incomplete = '_'
-
- // initial render
- this.progress = 0
-}
-
-Object.defineProperty(Progress.prototype, 'progress', {
- get: get
- , set: set
- , configurable: true
- , enumerable: true
-})
-
-function get () {
- return this._progress
-}
-
-function set (v) {
- this._progress = Math.max(0, Math.min(v, 100))
-
- var w = this.width - this.complete.length - this.incomplete.length
- , n = w * (this._progress / 100) | 0
- , i = w - n
- , com = c(this.complete, n)
- , inc = c(this.incomplete, i)
- , delta = this.cursor.newlines - this.delta
-
- assert.equal(com.length + inc.length, w)
-
- if (delta > 0) {
- this.cursor.up(delta)
- this.delta = this.cursor.newlines
- }
-
- this.cursor
- .horizontalAbsolute(0)
- .eraseLine(2)
- .fg.white()
- .write(this.open)
- .fg.grey()
- .bold()
- .write(com)
- .resetBold()
- .write(inc)
- .fg.white()
- .write(this.close)
- .fg.reset()
- .write('\n')
-}
-
-function c (char, length) {
- return Array.apply(null, Array(length)).map(function () {
- return char
- }).join('')
-}
-
-
-
-
-// Usage
-var width = parseInt(process.argv[2], 10) || process.stdout.getWindowSize()[0] / 2
- , p = new Progress(process.stdout, width)
-
-;(function tick () {
- p.progress += Math.random() * 5
- p.cursor
- .eraseLine(2)
- .write('Progress: ')
- .bold().write(p.progress.toFixed(2))
- .write('%')
- .resetBold()
- .write('\n')
- if (p.progress < 100)
- setTimeout(tick, 100)
-})()