How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • import ansiEscapes from 'ansi-escapes';
    
    // Moves the cursor two rows up and to the left
    process.stdout.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);
    //=> '\u001B[2A\u001B[1000D'
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">const</span> ansiEscapes<span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token function">cursorTo</span><span class="token punctuation">(</span>x<span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">,</span> y<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token function">cursorMove</span><span class="token punctuation">(</span>x<span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">,</span> y<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token function">cursorUp</span><span class="token punctuation">(</span>count<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token function">cursorDown</span><span class="token punctuation">(</span>count<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token function">cursorForward</span><span class="token punctuation">(</span>count<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token function">cursorBackward</span><span class="token punctuation">(</span>count<span class="token operator">?</span><span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> cursorLeft<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> cursorSavePosition<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token operator">...</span> <span class="token number">20</span> more <span class="token operator">...</span><span class="token punctuation">;</span> iTerm<span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token operator">...</span><span class="token punctuation">;</span> <span class="token punctuation">}</span><span class="token punctuation">;</span> <span class="token punctuation">}</span> <span class="token keyword">import</span> ansiEscapes</code></pre>
    Docs
    0
  • import hasAnsi from 'has-ansi';
    
    hasAnsi('\u001B[4mUnicorn\u001B[0m');
    //=> true
    
    hasAnsi('cake');
    //=> false
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">hasAnsi</span><span class="token punctuation">(</span><span class="token parameter">string<span class="token operator">:</span> any</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">boolean</span> <span class="token keyword">import</span> hasAnsi</code></pre>
    Docs
    0
  • var chalk = require('chalk');
     
    var str = chalk.bold.red('foo') + ' bar';
    console.log('[ANSI]', str)
    console.log('[HTML]', ansiHTML(str));
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">import</span> chalk</code></pre>
    Docs
    1
  • var ansiHTML = require('ansi-html');
    var str = ansiHTML('[ANSI_TEXT]');
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">function</span> <span class="token function">ansiHTML</span><span class="token punctuation">(</span><span class="token parameter">text<span class="token operator">:</span> string</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token function">any</span> <span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">module</span> ansiHTML <span class="token keyword">import</span> ansiHTML</code><div class="typing-tooltip-markup">Converts text with ANSI color codes to HTML markup.<br><br><em>@param</em> <code>text</code><br><br><em>@returns</em></div></pre>
    Docs
    0
  • // MongoDB won't automatically close this cursor after 10 minutes.
    const cursor = Person.find().cursor().addCursorFlag('noCursorTimeout', true);
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> cursor<span class="token operator">:</span> <span class="token builtin">any</span></code></pre>
    Docs
    0
  • import styles from 'ansi-styles';
    
    styles.color.ansi(styles.rgbToAnsi(100, 200, 15)); // RGB to 16 color ansi foreground code
    styles.bgColor.ansi(styles.hexToAnsi('#C0FFEE')); // HEX to 16 color ansi foreground code
    
    styles.color.ansi256(styles.rgbToAnsi256(100, 200, 15)); // RGB to 256 color ansi foreground code
    styles.bgColor.ansi256(styles.hexToAnsi256('#C0FFEE')); // HEX to 256 color ansi foreground code
    
    styles.color.ansi16m(100, 200, 15); // RGB to 16 million color foreground code
    styles.bgColor.ansi16m(...styles.hexToRgb('#C0FFEE')); // Hex (RGB) to 16 million color foreground code
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>alias<span class="token punctuation">)</span> <span class="token keyword">const</span> styles<span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token keyword">readonly</span> modifier<span class="token operator">:</span> Modifier<span class="token punctuation">;</span> <span class="token keyword">readonly</span> color<span class="token operator">:</span> ColorBase <span class="token operator">&amp;</span> ForegroundColor<span class="token punctuation">;</span> <span class="token keyword">readonly</span> bgColor<span class="token operator">:</span> ColorBase <span class="token operator">&amp;</span> BackgroundColor<span class="token punctuation">;</span> <span class="token keyword">readonly</span> codes<span class="token operator">:</span> ReadonlyMap<span class="token operator">&lt;</span><span class="token builtin">number</span><span class="token punctuation">,</span> <span class="token builtin">number</span><span class="token operator">></span><span class="token punctuation">;</span> <span class="token punctuation">}</span> <span class="token operator">&amp;</span> ForegroundColor <span class="token operator">&amp;</span> BackgroundColor <span class="token operator">&amp;</span> Modifier <span class="token operator">&amp;</span> ConvertColor <span class="token keyword">import</span> styles</code></pre>
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples