escape-code
ANSI Escape Code as an object
Usage
Provides a constructor that takes a single, string argument, and simply wraps that string value.
Presently it offers no utility beyond being able to do an instanceof
check. I use this in a stream
so that consumers can differentiate between escape codes and normal strings.
var EscapeCode = ;var assert = ; var code = '\u001b[32m'; // this is the useful bit;// or; // boolean value === true // toString just returns what you put in.assert; // toValue is overridden, so you can do non-strict comparisonassert; // and with regularExpressions ;assert;
Each instance has the following delegate methods that will be called on the underlying String.
- charAt
- charCodeAt
- concat
- indexOf
- lastIndexOf
- match
- replace
- search
- slice
- split
- substr
- substring
- toLowerCase
- toUpperCase
- trim
License
MIT © James Talmage