Codota Logo For Javascript
Array.keys
Code IndexAdd Codota to your IDE (free)

How to use
keys
function
in
Array

Best JavaScript code snippets using builtins.Array.keys(Showing top 15 results out of 891)

origin: porsager/postgres

t('big query body', async() => {
 await sql`create table test (x int)`
 return [1000, (await sql`insert into test ${
  sql([...Array(1000).keys()].map(x => ({ x })))
 }`).count, await sql`drop table test`]
})
origin: sindresorhus/on-change

test('should return an array iterator when array.keys is called', t => {
  let count = 0;
  let callbackCount = 0;
  const array = ['a', 'b', 'c'];

  const proxy = onChange(array, () => {
    callbackCount++;
  });

  for (const index of proxy.keys()) {
    t.is(count++, index);
  }

  t.is(callbackCount, 0);
});
origin: parse-community/parse-server

it('should not interfere with calls of different request ID', async () => {
  let counter = 0;
  Parse.Cloud.afterSave('MyClass', () => {
   counter++;
  });
  const promises = [...Array(100).keys()].map(() => {
   const params = {
    method: 'POST',
    url: 'http://localhost:8378/1/classes/MyClass',
    headers: {
     'X-Parse-Application-Id': Parse.applicationId,
     'X-Parse-Master-Key': Parse.masterKey,
     'X-Parse-Request-Id': uuid.v4()
    }
   };
   return request(params);
  });
  await expectAsync(Promise.all(promises)).toBeResolved();
  expect(counter).toBe(100);
 });
origin: parse-community/parse-server

it('$nor valid query', (done) => {
  const objects = Array.from(Array(10).keys()).map((rating) => {
   return new TestObject({ rating: rating });
  });
origin: discordjs/discord.js

this.shardList = [...Array(amount).keys()];
origin: parse-community/parse-server

it('containedBy pointer array', (done) => {
  const objects = Array.from(Array(10).keys()).map((idx) => {
   const obj = new Parse.Object('Object');
   obj.set('key', idx);
origin: GladysAssistant/Gladys

const routesKeys = Object.keys(routes);
const regexes = routesKeys.map((routeKey) => {
 const method = routeKey.split(' ')[0];
  regexes[i - 1].keys.forEach((key, index) => {
   req.params[key.name] = results[index + 1];
  });
origin: Automattic/wp-calypso

  media: Array.from( Array( 5 ).keys() ).map( ( val ) => ( {
    alt: `alt-${ val }`,
    url: `src-${ val }.png`,
Array.from( Array( 4 ).keys() ).map( ( val ) => ( {
  alt: `alt-${ val }`,
  src: `src-${ val }.png`,
origin: porsager/postgres

t('Throws if more than 65534 parameters', async() => {
 await sql`create table test (x int)`
 return ['MAX_PARAMETERS_EXCEEDED', (await sql`insert into test ${
  sql([...Array(65535).keys()].map(x => ({ x })))
 }`.catch(e => e.code)), await sql`drop table test`]
})
origin: o2team/athena

// 解析 font 相关属性
    Array.prototype.forEach.call(style, function (key) {

      if (key === 'font-family') {

        model.family = utils.unquotation(style['font-family']);

      } else if (key === 'font') {

        model.options = utils.fontValueParse(style.font) || {};
        model.family = model.options['font-family'];

        if (Array.isArray(model.family)) {
          model.family = model.family[0];
        }

        delete model.options['font-family'];

      } else if (getFontId.keys.indexOf(key) !== -1) {

        model.options[key] = style[key];
      } 
    });
origin: scality/cloudserver

function genPutTagObj(size, duplicate) {
  const retTagSet = [];
  Array.from(Array(size).keys()).forEach(ind => {
    retTagSet.push({
      Key: duplicate ? 'dupeKey' : `key${ind}`,
      Value: `Value${ind}`,
    });
  });
  return retTagSet;
}
origin: mysticatea/eslint-plugin-node

/**
 * Gets values of the `ignores` option.
 *
 * @returns {string[]} Values of the `ignores` option.
 */
function getIgnoresEnum() {
  return Object.keys(
    OPTIONS.reduce((retv, key) => {
      for (const alias of FEATURES[key].alias) {
        retv[alias] = true
      }
      retv[key] = true
      return retv
    }, Object.create(null))
  )
}
origin: scality/cloudserver

generateManyBucketNames(numberOfBuckets) {
    const random = Math.round(Math.random() * 100).toString();

    return Array
      .from(Array(numberOfBuckets).keys())
      .map(i => `${baseName}-${random}-${i}`);
  }
origin: o2team/athena

// 解析 font 相关属性
    Array.prototype.forEach.call(style, function (key) {

      if (key === 'font-family') {

        model.family = utils
        .commaToArray(style['font-family'])
        .map(utils.unquotation);

      } else if (key === 'font') {

        model.options = utils.fontValueParse(style.font) || {};
        model.family = model.options['font-family'];
        delete model.options['font-family'];

      } else if (getFontId.keys.indexOf(key) !== -1) {

        model.options[key] = style[key];
      } 
    });
origin: GladysAssistant/Gladys

const routesKeys = Object.keys(routes);
const regexes = routesKeys.map((routeKey) => {
 const method = routeKey.split(' ')[0];
  regexes[i - 1].keys.forEach((key, index) => {
   req.params[key.name] = results[index + 1];
  });
builtins(MDN)Arraykeys

JSDoc

Returns an iterable of keys in the 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

  • lodash
    Lodash modular utilities.
  • aws-sdk
    AWS SDK for JavaScript
  • 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.
  • through2
    A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise
  • chalk
    Terminal string styling done right
  • request
    Simplified HTTP request client.
  • readable-stream
    Streams3, a user-land copy of the stream library from Node.js
  • colors
    get colors in your node.js console
  • path
  • Top plugins for WebStorm
    The challenge is finding the best plugins for JavaScript development on Intellij IDEs. Who wants to sit there and go over hundreds of plugins to pick the best?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJavascript Code Index
Get Codota for your IDE now