Nodejs Array Object Key notIn( key, array )

Here you can find the source of notIn( key, array )

Method Source Code

Array.prototype.notIn = function( key, array )
{
    return this.filter( function(element)
    {/*from w  w  w .  j  a  v  a2 s  .  c  om*/
        var flag = true;

        for(var i = 0; i < array.length; i++)
        {
            if( element[key] == array[i][key]) flag = false;
        }

        return flag;
    });
};

Related

  1. containsReturn(key, value)
    Array.prototype.containsReturn = function(key, value) {
        var i = this.length;
        while (i--) {
            if (this[i][key] === value){
                return i;
        return false;
    
  2. getKeys()
    Array.prototype.getKeys = function(){
      var keys = '';
      for(var i in this) keys += ',' + i;
      return keys.substr(1).split(',');
    
  3. hasKey()
    Array.prototype.hasKey = function(){ 
      for(i in this){ 
        if(i === arguments[0]) 
          return true; 
      }; 
      return false; 
    };
    
  4. hasMultipleByKey(key)
    Array.prototype.hasMultipleByKey = function(key) {
        var foundOnce = false;
        var i = this.length - 1;
        while (i >= 0) {
            if (this[i].getKey() === key) {
                if (foundOnce)
                    return true;
                else
                    foundOnce = true;
    ...
    
  5. keys()
    Array.prototype.keys = function keys () {
      return new ArrayIterator(this, 'key');
    };
    
  6. objectIndex(key,value)
    Array.prototype.objectIndex = function(key,value) {
      for(var i = 0, len = this.length; i < len; i++) {
          if (this[i][key] === value) return i;
      return -1;
    
  7. options(textKey, valueKey)
    Array.prototype.options = function(textKey, valueKey) {
      var options = [];
      options = this.map(function(item) {
         return { text: item[textKey], value: item[valueKey] }
      });
      return options;
    
  8. updateObject(id, key, value_key, value)
    Array.prototype.updateObject = function (id, key, value_key, value) {
      for (var i = 0; i < this.length; i++) {
        if (this[i][key] == value) {
          return this[i][value_key] = value;
    };
    
  9. arrToObj()
    Array.prototype.arrToObj = function(){
      var obj = {};
      for (var i = 0; i < this.length; i++) {
        obj[i] = this[i]
      return obj;