zoukankan      html  css  js  c++  java
  • SimplePropertyRetriever

    var SimplePropertyRetriever = {
        getOwnEnumerables: function (obj) {
            return this._getPropertyNames(obj, truefalsethis._enumerable); // Or could use for..in filtered with hasOwnProperty or just this: return Object.keys(obj);
        },
        getOwnNonenumerables: function (obj) {
            return this._getPropertyNames(obj, truefalsethis._notEnumerable);
        },
        getOwnEnumerablesAndNonenumerables: function (obj) {
            return this._getPropertyNames(obj, truefalsethis._enumerableAndNotEnumerable); // Or just use: return Object.getOwnPropertyNames(obj);
        },
        getPrototypeEnumerables: function (obj) {
            return this._getPropertyNames(obj, falsetruethis._enumerable);
        },
        getPrototypeNonenumerables: function (obj) {
            return this._getPropertyNames(obj, falsetruethis._notEnumerable);
        },
        getPrototypeEnumerablesAndNonenumerables: function (obj) {
            return this._getPropertyNames(obj, falsetruethis._enumerableAndNotEnumerable);
        },
        getOwnAndPrototypeEnumerables: function (obj) {
            return this._getPropertyNames(obj, truetruethis._enumerable); // Or could use unfiltered for..in
        },
        getOwnAndPrototypeNonenumerables: function (obj) {
            return this._getPropertyNames(obj, truetruethis._notEnumerable);
        },
        getOwnAndPrototypeEnumerablesAndNonenumerables: function (obj) {
            return this._getPropertyNames(obj, truetruethis._enumerableAndNotEnumerable);
        },
        // Private static property checker callbacks
        _enumerable : function (obj, prop) {
            return obj.propertyIsEnumerable(prop);
        },
        _notEnumerable : function (obj, prop) {
            return !obj.propertyIsEnumerable(prop);
        },
        _enumerableAndNotEnumerable : function (obj, prop) {
            return true;
        },
        // Inspired by http://stackoverflow.com/a/8024294/271577
        _getPropertyNames : function getAllPropertyNames(obj, iterateSelfBool, iteratePrototypeBool, includePropCb) {
            var props = [];

            do {
                if (iterateSelfBool) {
                    Object.getOwnPropertyNames(obj).forEach(function (prop) {
                        if (props.indexOf(prop) === -1 && includePropCb(obj, prop)) {
                            props.push(prop);
                        }
                    });
                }
                if (!iteratePrototypeBool) {
                    break;
                }
                iterateSelfBool = true;
            } while (obj = Object.getPrototypeOf(obj));

            return props;
        }
    };
  • 相关阅读:
    存储过程语法
    ORA-20000:ORU-10027:buffer overflow,limit of 2000 bytes.
    ORACLE 存储过程异常捕获并抛出
    Sqlldr导入txt文件内容到数据库中
    ORA-01589: 要打开数据库则必须使用 RESETLOGS 或 NORESETLOGS 选项
    oracle将一个表中字段的值赋值到另一个表中字段(批量)
    (三)Solr——Solr的基本使用
    (二)Solr——Solr界面介绍
    jrebel 7免费激活(非破解) 和 IntelliJ Idea 2017 免费激活方法
    (一)Solr——简介和安装配置
  • 原文地址:https://www.cnblogs.com/shidengyun/p/5420892.html
Copyright © 2011-2022 走看看