Nodejs Object Key Get hasKey(skey)

Here you can find the source of hasKey(skey)

Method Source Code

Object.prototype.hasKey = function(skey){
   for (var key in this) {
      if (this.hasOwnProperty(key)) {
         if(key==skey){
            return true
         }/*from   w  w w .  j  av  a2s .com*/
      }
   }
   return false
}

Related

  1. keyAt(index)
    Object.prototype.keyAt = function(index){
      return Object.keys(this)[index];
    
  2. keys()
    Object.prototype.keys = function() {
        var keys = [];
        $.each(this, function(key, value) {
            keys.push(key);
        });
        return keys;
    };
    
  3. keys_length()
    Object.defineProperty(Object.prototype, 'keys_length', {
        enumerable:false,
        value:function() {
            var size = 0, key;
            for (key in this) {
                if (this.hasOwnProperty(key)) size++;
            return size;
    })
    
  4. getKeys()
    Object.prototype.getKeys = function(){
      var keys = [];
      for (var key in this) {
        if (this.hasOwnProperty(key)) {
          keys.push(key);
      return keys
    
  5. getOwn(key, defaultValue)
    Object.prototype.getOwn = function(key, defaultValue) {
        if (this.hasOwnProperty(key)) {
      return this[key];
        else {
      return defaultValue;
    };
    
  6. contains(key)
    Object.prototype.contains = function (key) {
        return this.hasOwnProperty(key);
    };
    
  7. empty()
    Object.prototype.empty = function() {
      return Object.keys(this).length <= 0;
    
  8. isEmpty()
    Object.prototype.isEmpty = function() {
        if (this == null) return true;
        if (this.length > 0)    return false;
        if (this.length === 0)  return true;
        for (var key in this) {
            if (hasOwnProperty.call(this, key)) return false;
        return true;
    };
    ...