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

How to use
hasOwnProperty
function
in
Array

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

origin: BrainJS/brain.js

  this.sizes[i] = nodes.length;
  for (const j in nodes) {
   if (nodes.hasOwnProperty(j)) {
    const node = nodes[j];
    this.biases[i][j] = layer[node].bias;
if (json.hasOwnProperty('trainOpts')) {
 this.updateTrainingOptions(json.trainOpts);
origin: Snipa22/nodejs-pool

function checkAliveMiners() {
  debug(threadName + "Verifying if miners are still alive");
  for (let minerId in activeMiners) {
    if (activeMiners.hasOwnProperty(minerId)) {
      let miner = activeMiners[minerId];
      if (Date.now() - miner.lastContact > global.config.pool.minerTimeout * 1000) {
        process.send({type: 'removeMiner', data: miner.port});
        delete activeMiners[minerId];
      }
    }
  }
}
origin: SamerAlsayegh/node-steam-bot-manager

// options is optional
  glob(self.fileManagerPath + pattern, function (er, files) {
    var cleanFiles = [];
    for (var fileFilter in files) {
      if (files.hasOwnProperty(fileFilter)) {
        cleanFiles.push(files[fileFilter].replace(self.fileManagerPath, ""));
      }
    }
    callback(er, cleanFiles);
  });
origin: Izzzio/izzzio

/**
   * Push to array
   * @param values
   * @return {Number}
   */
  push(...values) {
    for (let a in values) {
      if(values.hasOwnProperty(a)) {
        this._push(values[a]);
      }
    }
    return this.length;
  }
origin: Izzzio/izzzio

/**
   * Get results of voting at this moment
   */
  getResultsOfVoting() {
    let results = {};
    let voteVariants = this.contract.variants;
    for (let no in voteVariants) {
      if(voteVariants.hasOwnProperty(no)) {
        results[voteVariants[no]] = this._voteResults[no];
      }
    }
    return JSON.stringify({results, state: this._voteState});
  }
origin: abanarase/React_demos

editedData(){ 
    const{persons}=this.state;
    for (let key in persons) { 
     if (persons.hasOwnProperty(key)) 
     { 
      let value = persons[key];
      if(key == 'startDate' || key == 'endDate'){
       value=new Date(value);
      }               
      this.setState({[key]:value}); 
     } 
   } 
   
   }
origin: Snipa22/nodejs-pool

function newBlockTemplate(template) {
  let buffer = new Buffer(template.blocktemplate_blob, 'hex');
  let previous_hash = new Buffer(32);
  buffer.copy(previous_hash, 0, 7, 39);
  console.log(threadName + 'New block to mine at height: ' + template.height + '.  Difficulty: ' + template.difficulty);
  if (activeBlockTemplate) {
    pastBlockTemplates.enq(activeBlockTemplate);
  }
  activeBlockTemplate = new BlockTemplate(template);
  for (let minerId in activeMiners) {
    if (activeMiners.hasOwnProperty(minerId)) {
      let miner = activeMiners[minerId];
      debug(threadName + "Updating worker " + miner.payout + " With new work at height: " + template.height);
      miner.sendNewJob();
    }
  }
}
origin: argelius/react-onsenui-blog-examples

function o(){var e,t,n,o,i,s,a;for(var l in S)if(S.hasOwnProperty(l)){if(e=[],t=S[l],t.name&&(e.push(t.name.toLowerCase()),t.options&&t.options.aliases&&t.options.aliases.length))for(n=0;n<t.options.aliases.length;n++)e.push(t.options.aliases[n].toLowerCase());for(o=r(t.fn,"function")?t.fn():t.fn,i=0;i<e.length;i++)s=e[i],a=s.split("."),1===a.length?Modernizr[a[0]]=o:(!Modernizr[a[0]]||Modernizr[a[0]]instanceof Boolean||(Modernizr[a[0]]=new Boolean(Modernizr[a[0]])),Modernizr[a[0]][a[1]]=o),C.push((o?"":"no-")+a.join("-"))}}
origin: ONLYOFFICE/server

// Открываем базу данных
  _db.open (function (err, db) {
    // Открываем коллекцию. Если её не существует, она будет создана
    db.collection(_collectionName, function(err, collection) {
      // Получаем все элементы коллекции с помощью find()
      collection.find(function(err, cursor) {
        cursor.each(function(err, item) {
          // Null обозначает последний элемент
          if (item != null) {
            if (!result.hasOwnProperty (item.docid))
              result[item.docid] = [item];
            else
              result[item.docid].push(item);
          } else
            callbackFunction (result);
        });
        
        db.close();
      });
    });
  });
origin: Snipa22/nodejs-pool

function retargetMiners() {
  debug(threadName + "Performing difficulty check on miners");
  console.log('Performing difficulty update on miners');
  for (let minerId in activeMiners) {
    if (activeMiners.hasOwnProperty(minerId)) {
      let miner = activeMiners[minerId];
      if (!miner.fixed_diff) {
        miner.updateDifficulty();
      }
    }
  }
}
origin: Izzzio/izzzio

/**
 * Получает коллбек по таймстампу
 * @param timestamp
 * @return {*}
 */
function getThrustedAwait(timestamp) {
  for (let a in thrustedAwait) {
    if(thrustedAwait.hasOwnProperty(a)) {
      if(Number(thrustedAwait[a].timestamp) === Number(timestamp)) {
        return thrustedAwait[a];
      }
    }
  }

  return false;
}
origin: slmcassio/query-json

function _searchOnChildren(json, queryRegex, previousPath, result, options) {

 const keys = Object.keys(json);

 for(let index in keys) {
  if(!keys.hasOwnProperty(index)) {
   continue;
  }

  const key = keys[index];

  const currentPath = previousPath.slice();
  currentPath.push(key);

  if (queryRegex.exec(key)) {
   _addResult(currentPath, result, 'KEY', options);
  }

  const nextNode = json[key];
  _searchOnNode(nextNode, queryRegex, currentPath, result, options);
 }
}
origin: mrchimp/surly2

/**
  * Find files in a dir and run loadAimlFile on them
  * @param  {String} dir
  * @return {Undefined}
  */
 loadDir (dir, callback) {
  var files = fs.readdirSync(dir);

  debug('Loading dir' + dir);

  for (var i in files) {
   if (!files.hasOwnProperty(i)) continue;

   var name = dir + '/' + files[i];

   if (fs.statSync(name).isDirectory()) {
    debug('Ignoring directory: ' + name);
   } else if (name.substr(-5).toLowerCase() === '.aiml') {
    this.loadFile(name, callback);
   }
  }
 }
origin: Izzzio/izzzio

/**
   * Возвращает адрес сокет по адресу шины сообщений
   * @param address
   * @return {*}
   */
  function getSocketByBusAddress(address) {
    const sockets = getCurrentPeers(true);
    for (let i in sockets) {
      if(sockets.hasOwnProperty(i)) {
        if(sockets[i] && sockets[i].nodeMetaInfo) {
          if(sockets[i].nodeMetaInfo.messageBusAddress === address) {
            return sockets[i];
          }
        }
      }
    }

    return false;
  }
origin: crabjs/crabjs-cms

custom(optional) {
    if (_.isObject(optional)) {
      let keys = Object.keys(optional);

      for (let i in keys) {
        // Condition validate object params
        if (keys.hasOwnProperty(i) && _.isObject(optional[keys[i]])) {
          let key = keys[i],
            opt = optional[keys[i]];
          this[key](opt)
        } else {
          throw new Error('ERROR toolbars throw exception: Toolbars optional accept object params.');
        }
      }
    }
  }
builtins(MDN)ArrayhasOwnProperty

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

  • minimatch
    a glob matcher in javascript
  • axios
    Promise based HTTP client for the browser and node.js
  • debug
    small debugging utility
  • semver
    The semantic version parser used by npm.
  • mongodb
    The official MongoDB driver for Node.js
  • express
    Fast, unopinionated, minimalist web framework
  • redis
    Redis client library
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • mime-types
    The ultimate javascript content-type utility.
  • 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