Tabnine Logo For Javascript
Array.ownKeys
Code IndexAdd Tabnine to your IDE (free)

How to use
ownKeys
function
in
Array

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

origin: standard-things/esm

function init() {
 function ownKeys(object) {
  return isObjectLike(object)
   ? Reflect.ownKeys(object)
   : []
 }

 return ownKeys
}
origin: LFB/nodejs-koa-blog

 return []
let names = Reflect.ownKeys(instance)
names = names.filter((name) => {
origin: rherwig/shopware-advanced-generator

const mimicFn = (to, from) => {
  for (const prop of Reflect.ownKeys(from)) {
    Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
  }

  return to;
}
origin: di-ninja/di-ninja

addRules (rules = {}) {
  if (typeof rules === 'function') {
   rules = rules(this)
  }
  Reflect.ownKeys(rules).forEach(interfaceName => this.addRule(interfaceName, rules[interfaceName], false))
  this.rulesDetectLazyLoad()
 }
origin: manaflair/mylittledom

export function EasyComputedStyle(computed, base = Object.create(null)) {

  return new Proxy(base, {

    ownKeys(target) {

      return Reflect.ownKeys(styleProperties);

    },

    has(target, key) {

      return has(styleProperties, key);

    },

    get(target, key) {

      if (!has(styleProperties, key))
        throw new Error(`Failed to get a style property: '${key}' is not a valid style property name.`);

      return computed.get(key);

    }

  });

}
origin: mmendesas/walnutjs

getAllMethods() {
  const methods = Reflect.ownKeys(this.client)
   .filter(p => typeof this.client[p] === 'function'
    && !p.endsWith('Async'));

  return methods;
 }
origin: node-modules/cluster-client

const keys = Reflect.ownKeys(proto)
 .filter(key => typeof key !== 'symbol' &&
  !key.startsWith('_') &&
origin: shanyanwt/koa_vue_blog

/**
 * 获取一个实例的所有方法
 * @param obj 对象实例
 * @param option 参数
 *
 * ```js
 *     let validateFuncKeys: string[] = getAllMethodNames(this, {
 *     filter: key =>
 *   /validate([A-Z])\w+/g.test(key) && typeof this[key] === "function"
 *  });
 * ```
 */
const getAllMethodNames = (obj, option) => {
  let methods = new Set();
  // tslint:disable-next-line:no-conditional-assignment
  while ((obj = Reflect.getPrototypeOf(obj))) {
    let keys = Reflect.ownKeys(obj);
    keys.forEach(k => methods.add(k));
  }
  let keys = Array.from(methods.values());
  return prefixAndFilter(keys, option);
}
origin: egodigital/vscode-powertools

/**
  * Helper that recursively merges two data objects together.
  */
 function mergeData (to, from) {
  if (!from) { return to }
  var key, toVal, fromVal;

  var keys = hasSymbol
   ? Reflect.ownKeys(from)
   : Object.keys(from);

  for (var i = 0; i < keys.length; i++) {
   key = keys[i];
   // in case the object is already observed...
   if (key === '__ob__') { continue }
   toVal = to[key];
   fromVal = from[key];
   if (!hasOwn(to, key)) {
    set(to, key, fromVal);
   } else if (
    toVal !== fromVal &&
    isPlainObject(toVal) &&
    isPlainObject(fromVal)
   ) {
    mergeData(toVal, fromVal);
   }
  }
  return to
 }
origin: steinitz-zz/vix-simpleui-react

Reflect.ownKeys (proto).forEach
    (
      function (name)
      {
        if (name !== 'constructor')
        {
           if (hasMethod (proto, name))
           {
            array.push (name);
           }
        }
       }
    );
origin: introlab/odas_web

function resolveInject (inject, vm) {
 if (inject) {
  // inject is :any because flow is not smart enough to figure out cached
  // isArray here
  var isArray = Array.isArray(inject);
  var result = Object.create(null);
  var keys = isArray
   ? inject
   : hasSymbol
    ? Reflect.ownKeys(inject)
    : Object.keys(inject);

  for (var i = 0; i < keys.length; i++) {
   var key = keys[i];
   var provideKey = isArray ? key : inject[key];
   var source = vm;
   while (source) {
    if (source._provided && provideKey in source._provided) {
     result[key] = source._provided[provideKey];
     break
    }
    source = source.$parent;
   }
  }
  return result
 }
}
origin: shanyanwt/koa_vue_blog

/**
 * 获得实例的所有字段名
 * @param obj 实例
 * @param option 参数项
 *
 * ```js
 *     let keys = getAllFieldNames(this, {
 *      filter: key => {
 *    const value = this[key];
 *    if (isArray(value)) {
 *      if (value.length === 0) {
 *      return false;
 *    }
 *    for (const it of value) {
 *       if (!(it instanceof Rule)) {
 *         throw new Error("every item must be a instance of Rule");
 *      }
 *    }
 *    return true;
 *   } else {
 *    return value instanceof Rule;
 *    }
 *   }
 *  });
 * ```
 */
function getAllFieldNames(obj, option) {
  let keys = Reflect.ownKeys(obj);
  return prefixAndFilter(keys, option);
}
origin: di-ninja/di-ninja

Reflect.ownKeys(rules).forEach(function (interfaceName) {
    return _this4.addRule(interfaceName, rules[interfaceName], false);
   });
origin: LFB/nodejs-koa-wxapp

function findMembers(instance, fieldPrefix, funcPrefix) {

  // 递归函数
  function _find(instance) {
     //基线条件(跳出递归)
    if (instance.__proto__ === null)
      return []

    let names = Reflect.ownKeys(instance)
    names = names.filter((name)=>{
      // 过滤掉不满足条件的属性或方法名
      return _shouldKeep(name)
    })

    return [...names, ..._find(instance.__proto__)]
  }

  function _shouldKeep(value) {
    if (value.startsWith(fieldPrefix) || value.startsWith(funcPrefix))
      return true
  }

  return _find(instance)
}
origin: di-ninja/di-ninja

Reflect.ownKeys(rules).forEach(function (interfaceName) {
    return _this4.addRule(interfaceName, rules[interfaceName], false);
   });
builtins(MDN)ArrayownKeys

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

  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • mime-types
    The ultimate javascript content-type utility.
  • express
    Fast, unopinionated, minimalist web framework
  • cheerio
    Tiny, fast, and elegant implementation of core jQuery designed specifically for the server
  • qs
    A querystring parser that supports nesting and arrays, with a depth limit
  • aws-sdk
    AWS SDK for JavaScript
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • winston
    A logger for just about everything.
  • bluebird
    Full featured Promises/A+ implementation with exceptionally good performance
  • Top 12 Jupyter Notebook extensions
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