Socket
Socket
Sign inDemoInstall

cli-color

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-color - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="1.4.0"></a>
# [1.4.0](https://github.com/medikoo/cli-color/compare/v1.3.0...v1.4.0) (2018-10-23)
### Features
* introduce move top, bottom, lineBegin and lineEnd instructions ([ad53db1](https://github.com/medikoo/cli-color/commit/ad53db1))
<a name="1.3.0"></a>

@@ -7,0 +17,0 @@

57

move.js
"use strict";
var d = require("d")
, trunc = require("es5-ext/math/trunc")
, trunc = require("es5-ext/math/trunc");
, up, down, right, left
, abs = Math.abs, floor = Math.floor, max = Math.max;
var up, down, right, left, abs = Math.abs, floor = Math.floor, max = Math.max;

@@ -15,23 +14,31 @@ var getMove = function (control) {

};
module.exports = Object.defineProperties(function (x, y) {
x = isNaN(x) ? 0 : floor(x);
y = isNaN(y) ? 0 : floor(y);
return (x > 0 ? right(x) : left(-x)) + (y > 0 ? down(y) : up(-y));
}, {
up: d(up = getMove("A")),
down: d(down = getMove("B")),
right: d(right = getMove("C")),
left: d(left = getMove("D")),
to: d(function (x, y) {
x = isNaN(x) ? 1 : max(floor(x), 0) + 1;
y = isNaN(y) ? 1 : max(floor(y), 0) + 1;
return "\x1b[" + y + ";" + x + "H";
}),
lines: d(function (n) {
var dir;
n = trunc(n) || 0;
dir = n >= 0 ? "E" : "F";
n = floor(abs(n));
return "\x1b[" + n + dir;
})
});
module.exports = Object.defineProperties(
function (x, y) {
x = isNaN(x) ? 0 : floor(x);
y = isNaN(y) ? 0 : floor(y);
return (x > 0 ? right(x) : left(-x)) + (y > 0 ? down(y) : up(-y));
},
{
up: d((up = getMove("A"))),
down: d((down = getMove("B"))),
right: d((right = getMove("C"))),
left: d((left = getMove("D"))),
to: d(function (x, y) {
x = isNaN(x) ? 1 : max(floor(x), 0) + 1;
y = isNaN(y) ? 1 : max(floor(y), 0) + 1;
return "\x1b[" + y + ";" + x + "H";
}),
lines: d(function (n) {
var dir;
n = trunc(n) || 0;
dir = n >= 0 ? "E" : "F";
n = floor(abs(n));
return "\x1b[" + n + dir;
}),
top: d("\x1b[5000F"),
bottom: d("\x1b[5000B"),
lineBegin: d("\x1b[5000D"),
lineEnd: d("\x1b[5000C")
}
);
{
"name": "cli-color",
"version": "1.3.0",
"version": "1.4.0",
"description": "Colors, formatting and other tools for the console",

@@ -5,0 +5,0 @@ "author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",

@@ -578,3 +578,3 @@ [![*nix build status][nix-build-image]][nix-build-url]

Move cursor `n` lines forward if `n` is positive, otherwise `n` lines backward.
Move cursor `n` lines forward if `n` is positive, otherwise `n` lines backward, and place it at line beginning

@@ -585,2 +585,34 @@ ```javascript

##### clc.move.top
Move cursor to top of a screen
```javascript
process.stdout.write(clc.move.top);
```
##### clc.move.bottom
Move cursor to bottom of a screen
```javascript
process.stdout.write(clc.move.bottom);
```
##### clc.move.lineBegin
Move cursor to begin of a line
```javascript
process.stdout.write(clc.move.lineBegin);
```
##### clc.move.lineEnd
Move cursor to end of a line
```javascript
process.stdout.write(clc.move.lineEnd);
```
#### Terminal characteristics

@@ -587,0 +619,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc