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

  • const retryStr = `${colors.yellow(this.warn)} ${
        this.warn === 1 ? "retry" : "retries"
      }`;
    
      
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> retryStr<span class="token operator">:</span> <span class="token builtin">string</span></code></pre>
    /Kumar-Saksham/CSMM-CLI MIT
    0
  • function getMessage(msg) {
      return colors.yellow(msg);
    }
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">getMessage</span><span class="token punctuation">(</span><span class="token parameter">msg<span class="token operator">:</span> any</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">string</span></code></pre>
    /balmjs/balm mit
    0
  • module.exports.printItem = (item, id, indent) => {
      
      //...
    if (item.status === 'completed') {
        
        //...
    } else if (item.status === 'in_progress') {
        draft(indent,
          colors.yellow(`${figures.play} ${item.name}`),
          colors.grey(`${moment().diff(moment(item.started_at), 'seconds')}s`)
        )
      } else if (item.status === 'queued') {
        
        //...
    } else {
        if (item) draft(indent, item)
        else draft(indent, ' ')
      }
    }
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">var</span> module<span class="token operator">:</span> <span class="token punctuation">{</span> exports<span class="token operator">:</span> <span class="token keyword">typeof</span> module<span class="token punctuation">.</span>exports<span class="token punctuation">;</span> <span class="token punctuation">}</span></code></pre>
    /abskmj/hukum MIT
    0
  • console.log(c.yellow(`foo ${c.red.bold('red')} bar ${c.cyan('cyan')} baz`));
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">var</span> <span class="token builtin">console</span><span class="token operator">:</span> Console</code></pre>
    Docs
    0
  • const c = require('ansi-colors');
     
    console.log(c.red('This is a red string!'));
    console.log(c.green('This is a red string!'));
    console.log(c.cyan('This is a cyan string!'));
    console.log(c.yellow('This is a yellow string!'));
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">import</span> c</code></pre>
    Docs
    0
  • const cli = meow(
      `
      Usage
        left-phalange <file>
        lp <file>
    
      Options
        -i, --input           ${colors.cyan('Input Data type')}
        -o, --output          ${colors.cyan('Output Data type')}
        -p, --pretty          ${colors.cyan('Pretty output')}
        -C, --copy            ${colors.cyan('Copy output to clipboard')}
        -h, --help            ${colors.cyan('Show this help info')}
        -v, --version         ${colors.cyan('Show version')}
    
      Examples
        lp data.toml > data.json
        cat data.yaml | lp -p
      `,
      {
        
        //...
    ,
      },
    )
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> cli<span class="token operator">:</span> Result<span class="token operator">&lt;</span><span class="token punctuation">{</span> pretty<span class="token operator">:</span> <span class="token punctuation">{</span> type<span class="token operator">:</span> <span class="token string">"boolean"</span><span class="token punctuation">;</span> <span class="token keyword">default</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">;</span> alias<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token punctuation">}</span><span class="token punctuation">;</span> input<span class="token operator">:</span> <span class="token punctuation">{</span> alias<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token punctuation">}</span><span class="token punctuation">;</span> output<span class="token operator">:</span> <span class="token punctuation">{</span> alias<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token punctuation">}</span><span class="token punctuation">;</span> copy<span class="token operator">:</span> <span class="token punctuation">{</span> type<span class="token operator">:</span> <span class="token string">"boolean"</span><span class="token punctuation">;</span> <span class="token keyword">default</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">;</span> alias<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token punctuation">}</span><span class="token punctuation">;</span> help<span class="token operator">:</span> <span class="token punctuation">{</span> alias<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token punctuation">}</span><span class="token punctuation">;</span> version<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 operator">></span></code></pre>
    /fisker/left-phalange mit
    0
  • //...
    const skip = () => {};
    skip.add = () => skip;
    skip.run = () => skip;
    bench.skip = name => {
      console.log(colors.cyan('● ' + colors.unstyle(name) + ' (skipped)'));
      return skip;
    };
    
    bench('alpha')
      .add('fill 6.0', () => fill60('a', 'z'))
      .add('fill 7.0', () => fill70('a', 'z'))
      .run();
    
    
    
    //...
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">module</span> skip <span class="token keyword">const</span> skip<span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token keyword">void</span><span class="token punctuation">;</span> <span class="token function">add</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token operator">...</span><span class="token punctuation">;</span> <span class="token function">run</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token operator">...</span><span class="token punctuation">;</span> <span class="token punctuation">}</span></code></pre>
    /jonschlinkert/fill-range MIT
    0
  • FileStore.prototype.syncFolder = function (sFolder, sModif, fnCallback) {
        
        //...
    me._sendRequest(oRequest, function (oResponse) {
            if (oResponse.error) {
                log(colors.red('[FAILED]'), 'Folder', colors.cyan(sFolder), sModif + 'd.');
                fnCallback(util.createResponseError(oRequest, oResponse), oResponse);
            } else {
                log(colors.green('[OK]'), 'Folder', colors.cyan(sFolder), sModif + 'd.');
                fnCallback(null, oResponse);
            }
        });
    
    }
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">class</span> <span class="token class-name">FileStore</span> <span class="token keyword">var</span> FileStore<span class="token operator">:</span> <span class="token keyword">typeof</span> FileStore</code><div class="typing-tooltip-markup">FileStore constructor<br><br><em>@public</em><br><br><em>@param</em> <code>oOptions</code> — Options for FileStore<br><br><em>@returns</em></div></pre>
    /nrdev88/nwabap-ui5uploader Apache-2.0
    0
  • console.log(c.yellow(`foo ${c.red.bold('red')} bar ${c.cyan('cyan')} baz`));
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">var</span> <span class="token builtin">console</span><span class="token operator">:</span> Console</code></pre>
    Docs
    0
  • const c = require('ansi-colors');
     
    console.log(c.red('This is a red string!'));
    console.log(c.green('This is a red string!'));
    console.log(c.cyan('This is a cyan string!'));
    console.log(c.yellow('This is a yellow string!'));
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">import</span> c</code></pre>
    Docs
    0
  • async function start(options, invokeName = '') {
      
      //...
    if (isDotnetcore) {
        console.log(yellow(`using template: ${path.relative(process.cwd(), tplPath)}`));
        const baseDir = path.resolve(path.dirname(tplPath));
        await transformDotnetCodeUri(baseDir, serviceName, functionName, functionRes);
      } else {
        ({ tpl, tplPath } = await generateMergedTpl(options.template, true));
      }
    
      
    
      //...
    }
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">start</span><span class="token punctuation">(</span><span class="token parameter">options<span class="token operator">:</span> any<span class="token punctuation">,</span> invokeName<span class="token operator">?</span><span class="token operator">:</span> string</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">Promise</span><span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">></span></code></pre>
    /alibaba/funcraft mit
    0
  • const createFFTask = () => {
      
      //...
    creator.on('progress', e => {
        console.log(colors.yellow(`FFCreatorLite progress: ${(e.percent * 100) >> 0}%`));
      });
    
      creator.on('complete', e => {
        console.log(
          colors.magenta(`FFCreatorLite completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `),
        );
    
        console.log(colors.green(`\n --- You can press the s key or the w key to restart! --- \n`));
      });
    
      
    
      //...
    };
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">const</span> <span class="token function-variable function">createFFTask</span><span class="token operator">:</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> FFCreator</code></pre>
    /tnfe/FFCreatorLite MIT
    0
  • function setMsgColor(msg, color = null) {
      if (["success", "done"].includes(color)) {
        console.log(green("[✔] " + startCase(msg)));
      } else if (["danger", "error"].includes(color)) {
        console.log(red("[✖] " + startCase(msg)));
      } else if (["warning", "warn"].includes(color)) {
        console.log(brightRed("[✖] " + startCase(msg)));
      } else if (["info"].includes(color)) {
        console.log(yellow("[ℹ] " + startCase(msg)));
      } else {
        console.log("[#] " + startCase(msg));
      }
    }
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">setMsgColor</span><span class="token punctuation">(</span><span class="token parameter">msg<span class="token operator">:</span> string<span class="token punctuation">,</span> color<span class="token operator">?</span><span class="token operator">:</span> string</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token keyword">void</span></code><div class="typing-tooltip-markup"><em>@description</em> — A custom function to set console message with colors<br><br><em>@package</em> — Color<br><br><em>@param</em> <code>msg</code> — Message to show<br><br><em>@param</em> <code>color</code> — Message type <a href="undefined">'danger','success','info','error','done'</a></div></pre>
    /mohssineAboutaj/akwam-cli mit
    0
  • async function importService(serviceName, outputDir = '.', recursive = true, onlyConfig = false, skipIfExists = true) {
      
      //...
    if (serviceName) {
        const serviceMeta = await getServiceMeta(serviceName);
        serviceMetas.push(serviceMeta);
      } else {
        serviceMetas = await listServiceMetas();
      }
      if (serviceMetas.length === 0) {
        console.log(yellow('No service resources found.\n'));
        return;
      }
      const fullOutputDir = path.resolve(process.cwd(), outputDir);
      debug('Output Dir: %s', fullOutputDir);
      
      //...
    }
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">importService</span><span class="token punctuation">(</span><span class="token parameter">serviceName<span class="token operator">:</span> any<span class="token punctuation">,</span> outputDir<span class="token operator">?</span><span class="token operator">:</span> string<span class="token punctuation">,</span> recursive<span class="token operator">?</span><span class="token operator">:</span> boolean<span class="token punctuation">,</span> onlyConfig<span class="token operator">?</span><span class="token operator">:</span> boolean<span class="token punctuation">,</span> skipIfExists<span class="token operator">?</span><span class="token operator">:</span> boolean</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">Promise</span><span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">></span></code></pre>
    /alibaba/funcraft mit
    0
  • (async () => {
      let env = {
        DEPLOYMENT_URL: '',
        AUTHORIZATION_TOKEN: '',
        OUTPUT_DIRECTORY: './deployment_source',
        TEAM_ID: false
      };
      env.AUTHORIZATION_TOKEN = getAuthToken(await promptForAuthorizationToken());
    
      console.log(colors.yellow('Getting list of teams...'));
      env.TEAM_ID = await getTeamId(env.AUTHORIZATION_TOKEN);
    
      console.log(colors.yellow('Getting list of deployments...This might take a while...'));
      env.DEPLOYMENT_URL = `https://api.vercel.com/v5/now/deployments/${await getUidFromName(env)}/files`;
    
      
    
      //...
    })()
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">let</span> env<span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token constant">DEPLOYMENT_URL</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token constant">AUTHORIZATION_TOKEN</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token constant">OUTPUT_DIRECTORY</span><span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">;</span> <span class="token constant">TEAM_ID</span><span class="token operator">:</span> <span class="token builtin">boolean</span><span class="token punctuation">;</span> <span class="token punctuation">}</span></code></pre>
    /CalinaCristian/source-from-vercel-deployment mit
    0
  • function appAndPluginWatch(done) {
    
      log(colors.green('Watching source files...'));
    
      // Licenses
      gulp.watch(paths.license_md, () => appLicense());
    
      // App
      gulp.watch(paths.sass, () => appSass());
      gulp.watch(paths.templatecache, () => appNgTemplate());
      gulp.watch(paths.ng_annotate, (event) => appNgAnnotate(event));
      gulp.watch(paths.ng_translate, () => appNgTranslate());
      
      //...
    }
    
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">appAndPluginWatch</span><span class="token punctuation">(</span><span class="token parameter">done<span class="token operator">:</span> any</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token keyword">void</span></code></pre>
    /duniter/cesium agpl-3.0
    0
  • async update(name, content) {
        const fileName = this.getFileName(name);
        try {
          const result = await this.client.put(fileName, content);
          if (+result.res.statusCode === 200) {
            log(colors.green(`${fileName}上传成功!`));
          } else {
            log(colors.red(`${fileName}上传失败!`));
          }
        } catch (error) {
          log(colors.red(`${fileName}上传失败!`));
        }
      }
    
      
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token punctuation">(</span>method<span class="token punctuation">)</span> AliOSS<span class="token punctuation">.</span><span class="token function">update</span><span class="token punctuation">(</span>name<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">Promise</span><span class="token operator">&lt;</span><span class="token keyword">void</span><span class="token operator">></span></code></pre>
    /vbigbang/webpack-oss MIT
    0
  • function initTask() {
      
      //...
    log(colors.green("Generating default Nucleum project files"));
      log(
        colors.yellow(`
        To start the dev server run:
      `),
        colors.magenta(`
        yarn dev
      `)
      );
    
      
    
      //...
    }
    
    
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">function</span> <span class="token function">initTask</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> internal<span class="token punctuation">.</span>PassThrough <span class="token keyword">module</span> initTask</code></pre>
    /CosAnca/nucleum MIT
    0
  • const c = require('ansi-colors');
     
    console.log(c.red('This is a red string!'));
    console.log(c.green('This is a red string!'));
    console.log(c.cyan('This is a cyan string!'));
    console.log(c.yellow('This is a yellow string!'));
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">import</span> c</code></pre>
    Docs
    0
  • console.log(c.bold.red('this is a bold red message'));
    console.log(c.bold.yellow.italic('this is a bold yellow italicized message'));
    console.log(c.green.bold.underline('this is a bold green underlined message'));
    <pre class="typing-tooltip"><code data-language="javascript" class="language-javascript"><span class="token keyword">var</span> <span class="token builtin">console</span><span class="token operator">:</span> Console</code></pre>
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples