New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ansi-art/tools

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ansi-art/tools - npm Package Compare versions

Comparing version 3.0.0-alpha1 to 3.0.0-alpha3

.babelrc.js

488

.d.ts

@@ -80,2 +80,77 @@ /**

function backgroundColor(style: string): boolean;
/**
* The default constructor for Ansi
*/
class Ansi {
}
/**
* provide the length of an ansi string (not including control codes)
* @returns ansiColorCode
*/
function length(value: string): integer;
/**
* render an internal code into a code wrapped with the appropriate escape sequence
* @returns escapedCodes
*/
function codeRender(codes: any[]): any[];
/**
* code to clear all active ansi codes
* @returns ansiColorCode
*/
function clear(): integer;
/**
* take a substring of an ansi string relative to its stripped positions
* @returns ansiSubstring
*/
function substring(value: string, start: integer, stop: integer): string;
/**
* truncate past a fixed size
* @returns trimmedValue
*/
function trimTo(value: string, length: integer): string;
/**
* split sting into an array of elements, with or without styles
* @returns charAndStyleArray
*/
function toArray(value: string): any[];
/**
* return an array of characters with injected style information
* @returns charArray
*/
function toObjectArray(value: string, includeStyles: boolean): any[];
/**
* remove all ansi code from the string
* @returns asciiString
*/
function strip(value: string): any[];
/**
* get a character, relative to the stripped string positions
* @returns charAndStyleArray
*/
function charAt(value: string, index: integer, includePrefix: boolean): any[];
/**
* intersect many strings using styles
* @returns charAndStyleArray
*/
function interstyle(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* intersect many strings without styles
* @returns charAndStyleArray
*/
function intersect(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* map through a string one character at a time with style information attached
* @returns mappedValuesArray
*/
function map(value: string, handler: (...params: any[]) => any, includeLineEndings: boolean): any[];
/**
* determine whether the provided style is a foreground color
* @returns itIsForegroundColor
*/
function foregroundColor(style: string): boolean;
/**
* determine whether the provided style is a background color
* @returns itIsBackgroundColor
*/
function backgroundColor(style: string): boolean;
}

@@ -109,3 +184,416 @@

function drawOnto(value: string, offsetX: integer, offsetY: integer, isTransparent: boolean, mergeStyles: boolean): void;
/**
* The default constructor for the ansi grid
*/
class Grid {
}
/**
* set the internal height and width of the grid
*/
function codeRender(height: integer, width: integer): void;
/**
* render the contents of the grid back into a string
* @returns renderedString
*/
function toString(): string;
/**
* set a specific value on the grid and either provide or absorb the existing styles
*/
function setValue(x: integer, y: integer, chr: string, styles: any[]): void;
/**
* draw a 2d string onto the grid at a specified offset
*/
function drawOnto(value: string, offsetX: integer, offsetY: integer, isTransparent: boolean, mergeStyles: boolean): void;
}
/**
* Generate threshold maps as block characters
*/
declare module "@ansi-art/char-subgrid/src/blocks" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharBlocksTransformer extends AsciiCharSingleCharTransformer {
}
}
/**
* Generate threshold maps as braille characters
*/
declare module "@ansi-art/char-subgrid/src/braille" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharBlocksTransformer extends AsciiCharDoubleCharTransformer {
}
}
/**
* Generate threshold maps as dual quads base class
*/
declare module "@ansi-art/char-subgrid/src/double-char" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharDoubleCharTransformer extends SubGridTransformer {
}
}
/**
* Generate threshold maps as mini-quads base class
*/
declare module "@ansi-art/char-subgrid/src/single-char" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharSingleCharTransformer extends SubGridTransformer {
}
}
/**
* Generate threshold maps as slanted characters
*/
declare module "@ansi-art/char-subgrid/src/slants" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharSlantsTransformer extends AsciiCharSingleCharTransformer {
}
}
/**
* Generate threshold maps base class
*/
declare module "@ansi-art/char-subgrid/src/transform" {
/**
* The default constructor for SubGridTransformer
*/
class SubGridTransformer {
}
/**
* The map implementation (provided by implementations)
* @returns mappedValue
*/
function mapTo(value: string, mapFunction: (...params: any[]) => any): any;
/**
* The map implementation (provided by implementations)
* @returns transformedValue
*/
function transform(chunk: string): any;
/**
* The map implementation (provided by implementations)
* @returns extendedSubGridTransformer
*/
function extend(memberFunctions: any, constructor: (...params: any[]) => any): Class;
}
/**
* The default constructor for SubGridTransformer
*/
declare class Color {
}
/**
* The map implementation (provided by implementations)
* @returns ansiColorCode
*/
declare function ansi(depth: string | number): string;
/**
* The map implementation (provided by implementations)
* @returns hexValue
*/
declare function hex(): string;
/**
* The map implementation (provided by implementations)
* @returns rgbArray
*/
declare function rgb(): any[];
/**
* This provides an abstraction for doing work in a color space
*/
declare module "@ansi-art/color/src/context" {
/**
* The default constructor for ColorContext
*/
class ColorContext {
}
/**
* get the mapped color for a particular color in this context
* @returns ansiColorCode
*/
function getColor(color: Color, palette: ColorPalette): string;
}
/**
* get the distance between the provided color components
*/
declare module "@ansi-art/color/src/distance" {
/**
* get the distance between the provided color components
* @returns wrappedDistanceFn
*/
function colorDistance(distanceFn: (...params: any[]) => any): (...params: any[]) => any;
}
/**
* This provides an abstraction for the color profiles associated with drawing output
*/
declare module "@ansi-art/color/src/medium" {
/**
* The default constructor for ColorMedium
*/
class ColorMedium {
}
/**
* get the mapped color for a particular color in this context
* @returns ansiColorCode
*/
function getColors(): any[];
}
/**
* This provides an abstraction for performing color adhoc evaluations given a specific context (space + medium)
*/
declare module "@ansi-art/color/src/palette" {
/**
* The default constructor for ColorPalette
*/
class ColorPalette {
}
/**
* get the mapped color for a particular color in this context
* @returns mappedHexColor
*/
function interpretColor(hexColor: string): string;
/**
* get the mapped color for a particular color in this context
* @returns hexValueArray
*/
function getColors(): any[];
}
/**
* This provides default set of colors in a given color space
*/
declare module "@ansi-art/color/src/space" {
/**
* The default constructor for ColorSpace
*/
class ColorSpace {
}
/**
* get the set of colors for this color space, given the provided output medium
* @returns hexColorsArray
*/
function getColors(medium: ColorMedium): any[];
}
/**
* This provides an abstraction for doing work in an ansi context
*/
declare module "@ansi-art/tools/src/ansi" {
/**
* The default constructor for Ansi
*/
class Ansi {
}
/**
* provide the length of an ansi string (not including control codes)
* @returns ansiColorCode
*/
function length(value: string): integer;
/**
* render an internal code into a code wrapped with the appropriate escape sequence
* @returns escapedCodes
*/
function codeRender(codes: any[]): any[];
/**
* code to clear all active ansi codes
* @returns ansiColorCode
*/
function clear(): integer;
/**
* take a substring of an ansi string relative to its stripped positions
* @returns ansiSubstring
*/
function substring(value: string, start: integer, stop: integer): string;
/**
* truncate past a fixed size
* @returns trimmedValue
*/
function trimTo(value: string, length: integer): string;
/**
* split sting into an array of elements, with or without styles
* @returns charAndStyleArray
*/
function toArray(value: string): any[];
/**
* return an array of characters with injected style information
* @returns charArray
*/
function toObjectArray(value: string, includeStyles: boolean): any[];
/**
* remove all ansi code from the string
* @returns asciiString
*/
function strip(value: string): any[];
/**
* get a character, relative to the stripped string positions
* @returns charAndStyleArray
*/
function charAt(value: string, index: integer, includePrefix: boolean): any[];
/**
* intersect many strings using styles
* @returns charAndStyleArray
*/
function interstyle(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* intersect many strings without styles
* @returns charAndStyleArray
*/
function intersect(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* map through a string one character at a time with style information attached
* @returns mappedValuesArray
*/
function map(value: string, handler: (...params: any[]) => any, includeLineEndings: boolean): any[];
/**
* determine whether the provided style is a foreground color
* @returns itIsForegroundColor
*/
function foregroundColor(style: string): boolean;
/**
* determine whether the provided style is a background color
* @returns itIsBackgroundColor
*/
function backgroundColor(style: string): boolean;
/**
* The default constructor for Ansi
*/
class Ansi {
}
/**
* provide the length of an ansi string (not including control codes)
* @returns ansiColorCode
*/
function length(value: string): integer;
/**
* render an internal code into a code wrapped with the appropriate escape sequence
* @returns escapedCodes
*/
function codeRender(codes: any[]): any[];
/**
* code to clear all active ansi codes
* @returns ansiColorCode
*/
function clear(): integer;
/**
* take a substring of an ansi string relative to its stripped positions
* @returns ansiSubstring
*/
function substring(value: string, start: integer, stop: integer): string;
/**
* truncate past a fixed size
* @returns trimmedValue
*/
function trimTo(value: string, length: integer): string;
/**
* split sting into an array of elements, with or without styles
* @returns charAndStyleArray
*/
function toArray(value: string): any[];
/**
* return an array of characters with injected style information
* @returns charArray
*/
function toObjectArray(value: string, includeStyles: boolean): any[];
/**
* remove all ansi code from the string
* @returns asciiString
*/
function strip(value: string): any[];
/**
* get a character, relative to the stripped string positions
* @returns charAndStyleArray
*/
function charAt(value: string, index: integer, includePrefix: boolean): any[];
/**
* intersect many strings using styles
* @returns charAndStyleArray
*/
function interstyle(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* intersect many strings without styles
* @returns charAndStyleArray
*/
function intersect(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* map through a string one character at a time with style information attached
* @returns mappedValuesArray
*/
function map(value: string, handler: (...params: any[]) => any, includeLineEndings: boolean): any[];
/**
* determine whether the provided style is a foreground color
* @returns itIsForegroundColor
*/
function foregroundColor(style: string): boolean;
/**
* determine whether the provided style is a background color
* @returns itIsBackgroundColor
*/
function backgroundColor(style: string): boolean;
}
/**
* This provides an abstraction for doing work in with an ansi string in a grid context
*/
declare module "@ansi-art/tools/src/grid" {
/**
* The default constructor for the ansi grid
*/
class Grid {
}
/**
* set the internal height and width of the grid
*/
function codeRender(height: integer, width: integer): void;
/**
* render the contents of the grid back into a string
* @returns renderedString
*/
function toString(): string;
/**
* set a specific value on the grid and either provide or absorb the existing styles
*/
function setValue(x: integer, y: integer, chr: string, styles: any[]): void;
/**
* draw a 2d string onto the grid at a specified offset
*/
function drawOnto(value: string, offsetX: integer, offsetY: integer, isTransparent: boolean, mergeStyles: boolean): void;
/**
* The default constructor for the ansi grid
*/
class Grid {
}
/**
* set the internal height and width of the grid
*/
function codeRender(height: integer, width: integer): void;
/**
* render the contents of the grid back into a string
* @returns renderedString
*/
function toString(): string;
/**
* set a specific value on the grid and either provide or absorb the existing styles
*/
function setValue(x: integer, y: integer, chr: string, styles: any[]): void;
/**
* draw a 2d string onto the grid at a specified offset
*/
function drawOnto(value: string, offsetX: integer, offsetY: integer, isTransparent: boolean, mergeStyles: boolean): void;
}

33

package.json
{
"name": "@ansi-art/tools",
"version": "3.0.0-alpha1",
"main": "tools.js",
"version": "3.0.0-alpha3",
"main": "tools.cjs",
"module": "tools.mjs",
"devDependencies": {
"@babel/cli": "^7.22.5",
"@babel/core": "^7.22.5",
"@babel/plugin-transform-modules-umd": "^7.22.5",
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"babel-plugin-search-and-replace": "^1.1.1",
"chai": "^4.3.7",
"environment-safe-chai": "^0.0.1",
"eslint": "^8.43.0",
"husky": "^8.0.3",

@@ -17,9 +24,14 @@ "jsdoc": "^3.6.3",

"scripts": {
"lint": "./node_modules/.bin/eslint *.js src/*.js test/*.js",
"test": "./node_modules/.bin/mocha",
"lint": "./node_modules/.bin/eslint *.mjs src/*.mjs test/*.mjs",
"test-require": "./node_modules/.bin/mocha test/test.cjs",
"test-import": "./node_modules/.bin/mocha test/test.mjs",
"test": "npm run test-require; npm run test-import",
"build": "npm run build-commonjs-root; npm run build-dist",
"build-dist": "./node_modules/.bin/babel src --out-dir dist --out-file-extension .cjs",
"build-commonjs-root": "./node_modules/.bin/babel tools.mjs > tools.cjs",
"container-test": "docker build . -t tools -f ./containers/test.dockerfile; docker logs --follow \"$(docker run -d tools)\"",
"generate-types": "./node_modules/.bin/jsdoc -t node_modules/tsd-jsdoc/dist -r src/. -d types",
"generate-types": "./node_modules/.bin/jsdoc -t node_modules/tsd-jsdoc/dist -c jsdoc.json -r src/. -d types",
"generate-typescript-root": "cat ./types/types.d.ts > .d.ts",
"generate-docs": "for i in src/*.js; do ./node_modules/.bin/jsdoc2md \"${i}\" > \"docs/.md\"; done",
"tag-current-version":"git tag -a $(echo $(cat package.json | jq '(\"v\" + .version)' --unbuffered) | tr -d \"\\\"\") -m \"Release Version\"",
"generate-docs": "for i in src/*.mjs; do echo \"${i}\";./node_modules/.bin/jsdoc2md -c jsdoc.json \"${i}\" > \"docs/$(basename ${i%.mjs}).md\"; done",
"tag-current-version": "git tag -a $(echo $(cat package.json | jq '(\"v\" + .version)' --unbuffered) | tr -d \"\\\"\") -m \"Release Version\"",
"npm-publish": "npm run tag-current-version; git push --follow-tags; npm publish",

@@ -31,2 +43,3 @@ "add-generated-files-to-commit": "git add docs/*.md; git add types/*.ts; git add .d.ts"

"lint",
"build",
"test",

@@ -40,6 +53,6 @@ "container-test",

"dependencies": {
"@ansi-art/char-subgrid": "^3.0.0-alpha2",
"@ansi-art/color": "^3.0.0-alpha2",
"maplex": "^0.0.3"
"@ansi-art/char-subgrid": "^3.0.0-alpha3",
"@ansi-art/color": "^3.0.0-alpha3",
"maplex": "^1.0.0"
}
}

@@ -80,2 +80,77 @@ /**

function backgroundColor(style: string): boolean;
/**
* The default constructor for Ansi
*/
class Ansi {
}
/**
* provide the length of an ansi string (not including control codes)
* @returns ansiColorCode
*/
function length(value: string): integer;
/**
* render an internal code into a code wrapped with the appropriate escape sequence
* @returns escapedCodes
*/
function codeRender(codes: any[]): any[];
/**
* code to clear all active ansi codes
* @returns ansiColorCode
*/
function clear(): integer;
/**
* take a substring of an ansi string relative to its stripped positions
* @returns ansiSubstring
*/
function substring(value: string, start: integer, stop: integer): string;
/**
* truncate past a fixed size
* @returns trimmedValue
*/
function trimTo(value: string, length: integer): string;
/**
* split sting into an array of elements, with or without styles
* @returns charAndStyleArray
*/
function toArray(value: string): any[];
/**
* return an array of characters with injected style information
* @returns charArray
*/
function toObjectArray(value: string, includeStyles: boolean): any[];
/**
* remove all ansi code from the string
* @returns asciiString
*/
function strip(value: string): any[];
/**
* get a character, relative to the stripped string positions
* @returns charAndStyleArray
*/
function charAt(value: string, index: integer, includePrefix: boolean): any[];
/**
* intersect many strings using styles
* @returns charAndStyleArray
*/
function interstyle(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* intersect many strings without styles
* @returns charAndStyleArray
*/
function intersect(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* map through a string one character at a time with style information attached
* @returns mappedValuesArray
*/
function map(value: string, handler: (...params: any[]) => any, includeLineEndings: boolean): any[];
/**
* determine whether the provided style is a foreground color
* @returns itIsForegroundColor
*/
function foregroundColor(style: string): boolean;
/**
* determine whether the provided style is a background color
* @returns itIsBackgroundColor
*/
function backgroundColor(style: string): boolean;
}

@@ -109,3 +184,416 @@

function drawOnto(value: string, offsetX: integer, offsetY: integer, isTransparent: boolean, mergeStyles: boolean): void;
/**
* The default constructor for the ansi grid
*/
class Grid {
}
/**
* set the internal height and width of the grid
*/
function codeRender(height: integer, width: integer): void;
/**
* render the contents of the grid back into a string
* @returns renderedString
*/
function toString(): string;
/**
* set a specific value on the grid and either provide or absorb the existing styles
*/
function setValue(x: integer, y: integer, chr: string, styles: any[]): void;
/**
* draw a 2d string onto the grid at a specified offset
*/
function drawOnto(value: string, offsetX: integer, offsetY: integer, isTransparent: boolean, mergeStyles: boolean): void;
}
/**
* Generate threshold maps as block characters
*/
declare module "@ansi-art/char-subgrid/src/blocks" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharBlocksTransformer extends AsciiCharSingleCharTransformer {
}
}
/**
* Generate threshold maps as braille characters
*/
declare module "@ansi-art/char-subgrid/src/braille" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharBlocksTransformer extends AsciiCharDoubleCharTransformer {
}
}
/**
* Generate threshold maps as dual quads base class
*/
declare module "@ansi-art/char-subgrid/src/double-char" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharDoubleCharTransformer extends SubGridTransformer {
}
}
/**
* Generate threshold maps as mini-quads base class
*/
declare module "@ansi-art/char-subgrid/src/single-char" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharSingleCharTransformer extends SubGridTransformer {
}
}
/**
* Generate threshold maps as slanted characters
*/
declare module "@ansi-art/char-subgrid/src/slants" {
/**
* UTF Block based SubGridTransformer
*/
class AsciiCharSlantsTransformer extends AsciiCharSingleCharTransformer {
}
}
/**
* Generate threshold maps base class
*/
declare module "@ansi-art/char-subgrid/src/transform" {
/**
* The default constructor for SubGridTransformer
*/
class SubGridTransformer {
}
/**
* The map implementation (provided by implementations)
* @returns mappedValue
*/
function mapTo(value: string, mapFunction: (...params: any[]) => any): any;
/**
* The map implementation (provided by implementations)
* @returns transformedValue
*/
function transform(chunk: string): any;
/**
* The map implementation (provided by implementations)
* @returns extendedSubGridTransformer
*/
function extend(memberFunctions: any, constructor: (...params: any[]) => any): Class;
}
/**
* The default constructor for SubGridTransformer
*/
declare class Color {
}
/**
* The map implementation (provided by implementations)
* @returns ansiColorCode
*/
declare function ansi(depth: string | number): string;
/**
* The map implementation (provided by implementations)
* @returns hexValue
*/
declare function hex(): string;
/**
* The map implementation (provided by implementations)
* @returns rgbArray
*/
declare function rgb(): any[];
/**
* This provides an abstraction for doing work in a color space
*/
declare module "@ansi-art/color/src/context" {
/**
* The default constructor for ColorContext
*/
class ColorContext {
}
/**
* get the mapped color for a particular color in this context
* @returns ansiColorCode
*/
function getColor(color: Color, palette: ColorPalette): string;
}
/**
* get the distance between the provided color components
*/
declare module "@ansi-art/color/src/distance" {
/**
* get the distance between the provided color components
* @returns wrappedDistanceFn
*/
function colorDistance(distanceFn: (...params: any[]) => any): (...params: any[]) => any;
}
/**
* This provides an abstraction for the color profiles associated with drawing output
*/
declare module "@ansi-art/color/src/medium" {
/**
* The default constructor for ColorMedium
*/
class ColorMedium {
}
/**
* get the mapped color for a particular color in this context
* @returns ansiColorCode
*/
function getColors(): any[];
}
/**
* This provides an abstraction for performing color adhoc evaluations given a specific context (space + medium)
*/
declare module "@ansi-art/color/src/palette" {
/**
* The default constructor for ColorPalette
*/
class ColorPalette {
}
/**
* get the mapped color for a particular color in this context
* @returns mappedHexColor
*/
function interpretColor(hexColor: string): string;
/**
* get the mapped color for a particular color in this context
* @returns hexValueArray
*/
function getColors(): any[];
}
/**
* This provides default set of colors in a given color space
*/
declare module "@ansi-art/color/src/space" {
/**
* The default constructor for ColorSpace
*/
class ColorSpace {
}
/**
* get the set of colors for this color space, given the provided output medium
* @returns hexColorsArray
*/
function getColors(medium: ColorMedium): any[];
}
/**
* This provides an abstraction for doing work in an ansi context
*/
declare module "@ansi-art/tools/src/ansi" {
/**
* The default constructor for Ansi
*/
class Ansi {
}
/**
* provide the length of an ansi string (not including control codes)
* @returns ansiColorCode
*/
function length(value: string): integer;
/**
* render an internal code into a code wrapped with the appropriate escape sequence
* @returns escapedCodes
*/
function codeRender(codes: any[]): any[];
/**
* code to clear all active ansi codes
* @returns ansiColorCode
*/
function clear(): integer;
/**
* take a substring of an ansi string relative to its stripped positions
* @returns ansiSubstring
*/
function substring(value: string, start: integer, stop: integer): string;
/**
* truncate past a fixed size
* @returns trimmedValue
*/
function trimTo(value: string, length: integer): string;
/**
* split sting into an array of elements, with or without styles
* @returns charAndStyleArray
*/
function toArray(value: string): any[];
/**
* return an array of characters with injected style information
* @returns charArray
*/
function toObjectArray(value: string, includeStyles: boolean): any[];
/**
* remove all ansi code from the string
* @returns asciiString
*/
function strip(value: string): any[];
/**
* get a character, relative to the stripped string positions
* @returns charAndStyleArray
*/
function charAt(value: string, index: integer, includePrefix: boolean): any[];
/**
* intersect many strings using styles
* @returns charAndStyleArray
*/
function interstyle(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* intersect many strings without styles
* @returns charAndStyleArray
*/
function intersect(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* map through a string one character at a time with style information attached
* @returns mappedValuesArray
*/
function map(value: string, handler: (...params: any[]) => any, includeLineEndings: boolean): any[];
/**
* determine whether the provided style is a foreground color
* @returns itIsForegroundColor
*/
function foregroundColor(style: string): boolean;
/**
* determine whether the provided style is a background color
* @returns itIsBackgroundColor
*/
function backgroundColor(style: string): boolean;
/**
* The default constructor for Ansi
*/
class Ansi {
}
/**
* provide the length of an ansi string (not including control codes)
* @returns ansiColorCode
*/
function length(value: string): integer;
/**
* render an internal code into a code wrapped with the appropriate escape sequence
* @returns escapedCodes
*/
function codeRender(codes: any[]): any[];
/**
* code to clear all active ansi codes
* @returns ansiColorCode
*/
function clear(): integer;
/**
* take a substring of an ansi string relative to its stripped positions
* @returns ansiSubstring
*/
function substring(value: string, start: integer, stop: integer): string;
/**
* truncate past a fixed size
* @returns trimmedValue
*/
function trimTo(value: string, length: integer): string;
/**
* split sting into an array of elements, with or without styles
* @returns charAndStyleArray
*/
function toArray(value: string): any[];
/**
* return an array of characters with injected style information
* @returns charArray
*/
function toObjectArray(value: string, includeStyles: boolean): any[];
/**
* remove all ansi code from the string
* @returns asciiString
*/
function strip(value: string): any[];
/**
* get a character, relative to the stripped string positions
* @returns charAndStyleArray
*/
function charAt(value: string, index: integer, includePrefix: boolean): any[];
/**
* intersect many strings using styles
* @returns charAndStyleArray
*/
function interstyle(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* intersect many strings without styles
* @returns charAndStyleArray
*/
function intersect(...value: string[], callback?: (...params: any[]) => any): Promise | null;
/**
* map through a string one character at a time with style information attached
* @returns mappedValuesArray
*/
function map(value: string, handler: (...params: any[]) => any, includeLineEndings: boolean): any[];
/**
* determine whether the provided style is a foreground color
* @returns itIsForegroundColor
*/
function foregroundColor(style: string): boolean;
/**
* determine whether the provided style is a background color
* @returns itIsBackgroundColor
*/
function backgroundColor(style: string): boolean;
}
/**
* This provides an abstraction for doing work in with an ansi string in a grid context
*/
declare module "@ansi-art/tools/src/grid" {
/**
* The default constructor for the ansi grid
*/
class Grid {
}
/**
* set the internal height and width of the grid
*/
function codeRender(height: integer, width: integer): void;
/**
* render the contents of the grid back into a string
* @returns renderedString
*/
function toString(): string;
/**
* set a specific value on the grid and either provide or absorb the existing styles
*/
function setValue(x: integer, y: integer, chr: string, styles: any[]): void;
/**
* draw a 2d string onto the grid at a specified offset
*/
function drawOnto(value: string, offsetX: integer, offsetY: integer, isTransparent: boolean, mergeStyles: boolean): void;
/**
* The default constructor for the ansi grid
*/
class Grid {
}
/**
* set the internal height and width of the grid
*/
function codeRender(height: integer, width: integer): void;
/**
* render the contents of the grid back into a string
* @returns renderedString
*/
function toString(): string;
/**
* set a specific value on the grid and either provide or absorb the existing styles
*/
function setValue(x: integer, y: integer, chr: string, styles: any[]): void;
/**
* draw a 2d string onto the grid at a specified offset
*/
function drawOnto(value: string, offsetX: integer, offsetY: integer, isTransparent: boolean, mergeStyles: boolean): void;
}
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