congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo For Javascript
Array
Code IndexAdd Tabnine to your IDE (free)

How to use
Array
in
builtins

Best JavaScript code snippets using builtins.Array(Showing top 15 results out of 114,588)

origin: GitSquared/edex-ui

fs.readdirSync(themesDir).forEach(th => {
    if (!th.endsWith(".json")) return;
    th = th.replace(".json", "");
    if (th === window.settings.theme) return;
    themes += `<option>${th}</option>`;
  });
origin: GitSquared/edex-ui

function getNextVertexInPool() {

    if ( _vertexCount === _vertexPoolLength ) {

      var vertex = new THREE.RenderableVertex();
      _vertexPool.push( vertex );
      _vertexPoolLength ++;
      _vertexCount ++;
      return vertex;

    }

    return _vertexPool[ _vertexCount ++ ];

  }
origin: GitSquared/edex-ui

// Defines

  function generateDefines ( defines ) {

    var value, chunk, chunks = [];

    for ( var d in defines ) {

      value = defines[ d ];
      if ( value === false ) continue;

      chunk = "#define " + d + " " + value;
      chunks.push( chunk );

    }

    return chunks.join( "\n" );

  }
origin: Netflix/pollyjs

export default function getBufferFromStream(stream) {
 return new Promise(resolve => {
  const chunks = [];

  stream.on('data', chunk => {
   chunks.push(chunk);
  });

  stream.on('end', () => {
   resolve(Buffer.concat(chunks));
  });
 });
}
origin: Netflix/pollyjs

function generateRecordingName(context) {
 const { currentTest } = context;
 const parts = [currentTest.title];
 let parent = currentTest.parent;

 while (parent && parent.title) {
  parts.push(parent.title);
  parent = parent.parent;
 }

 return parts.reverse().join('/');
}
origin: Netflix/pollyjs

it('.emit()', async function() {
   expect(emitter.emit('a')).to.be.a('promise');

   const array = [];

   emitter.on('a', () => array.push(1));
   emitter.on('a', async () => {
    await timeout(10);
    array.push(2);
   });
   emitter.on('a', () => array.push(3));

   expect(await emitter.emit('a')).to.be.true;
   expect(array).to.have.ordered.members([1, 2, 3]);
  });
origin: Netflix/pollyjs

function totalTime(timings = {}) {
 return keys(timings).reduce(
  (total, k) => (timings[k] > 0 ? (total += timings[k]) : total),
  0
 );
}
origin: Netflix/pollyjs

async flush() {
  const NOOP = () => {};

  await Promise.all(
   // The NOOP is there to handle both a resolved and rejected promise
   // to ensure the promise resolves regardless of the outcome.
   this._requests.map(r => Promise.resolve(r.promise).then(NOOP, NOOP))
  );
 }
origin: Netflix/pollyjs

export default function buildUrl(...paths) {
 const url = new URL(
  paths
   .map(p => p && (p + '').trim()) // Trim each string
   .filter(Boolean) // Remove empty strings or other falsy paths
   .join('/')
 );

 // Replace 2+ consecutive slashes with 1. (e.g. `///` --> `/`)
 url.set('pathname', url.pathname.replace(/\/{2,}/g, '/'));

 return url.href;
}
origin: Netflix/pollyjs

it('.emitSync() - stopPropagation', async function() {
   const array = [];

   emitter.on('a', e => {
    e.stopPropagation();
    array.push(1);
   });
   emitter.on('a', () => array.push(2));

   expect(emitter.emitSync('a')).to.be.false;
   expect(array).to.have.ordered.members([1]);
  });
origin: Netflix/pollyjs

function captureRequests(server) {
 const reqs = [];

 server.any().on('request', req => reqs.push(req));

 return reqs;
}
origin: Sly777/ran

Object.keys(publicEnv).forEach(key => {
   if (!process.env[key]) {
    process.env[key] = publicEnv[key];
   }
  });
origin: GitSquared/edex-ui

function getNextFaceInPool() {

    if ( _faceCount === _facePoolLength ) {

      var face = new THREE.RenderableFace();
      _facePool.push( face );
      _facePoolLength ++;
      _faceCount ++;
      return face;

    }

    return _facePool[ _faceCount ++ ];


  }
origin: Netflix/pollyjs

_orderedHandlers() {
  return [...this.middleware, this].reduce((handlers, route) => {
   handlers.push(...route.handlers.map(handler => ({ route, handler })));

   return handlers;
  }, []);
 }
origin: Netflix/pollyjs

it('.emit() - stopPropagation', async function() {
   const array = [];

   emitter.on('a', async e => {
    e.stopPropagation();
    array.push(1);
   });
   emitter.on('a', () => array.push(2));

   expect(await emitter.emit('a')).to.be.false;
   expect(array).to.have.ordered.members([1]);
  });
builtins(MDN)Array

Most used builtins functions

  • Console.log
  • Console.error
  • Promise.then
    Attaches callbacks for the resolution and/or rejection of the Promise.
  • Promise.catch
    Attaches a callback for only the rejection of the Promise.
  • Array.push
    Appends new elements to an array, and returns the new length of the array.
  • Array.length,
  • Array.map,
  • String.indexOf,
  • fetch,
  • Window.location,
  • Window.addEventListener,
  • ObjectConstructor.keys,
  • Array.forEach,
  • Location.reload,
  • Response.status,
  • Navigator.serviceWorker,
  • ServiceWorkerContainer.register,
  • ServiceWorkerRegistration.installing,
  • ServiceWorkerContainer.controller

Popular in JavaScript

  • redis
    Redis client library
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • webpack
    Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  • ms
    Tiny millisecond conversion utility
  • mongodb
    The official MongoDB driver for Node.js
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now