Socket
Socket
Sign inDemoInstall

ansi-escapes

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-escapes - npm Package Compare versions

Comparing version 6.0.0 to 6.1.0

13

index.js

@@ -8,4 +8,11 @@ import process from 'node:process';

const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
/* global window */
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
const isTerminalApp = !isBrowser && process.env.TERM_PROGRAM === 'Apple_Terminal';
const isWindows = !isBrowser && process.platform === 'win32';
const cwdFunction = isBrowser ? () => {
throw new Error('`process.cwd()` only works in Node.js, not the browser.');
} : process.cwd;
const ansiEscapes = {};

@@ -86,3 +93,3 @@

ansiEscapes.clearTerminal = process.platform === 'win32'
ansiEscapes.clearTerminal = isWindows
? `${ansiEscapes.eraseScreen}${ESC}0f`

@@ -131,3 +138,3 @@ // 1. Erases the screen (Only done in case `2` is not supported)

ansiEscapes.iTerm = {
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,

@@ -134,0 +141,0 @@ annotation(message, options = {}) {

{
"name": "ansi-escapes",
"version": "6.0.0",
"version": "6.1.0",
"description": "ANSI escape codes for manipulating the terminal",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -21,2 +21,16 @@ # ansi-escapes

**You can also use it in the browser with Xterm.js:**
```js
import ansiEscapes from 'ansi-escapes';
import {Terminal} from 'xterm';
import 'xterm/css/xterm.css';
const terminal = new Terminal({…});
// Moves the cursor two rows up and to the left
terminal.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);
//=> '\u001B[2A\u001B[1000D'
```
## API

@@ -23,0 +37,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