Nodejs Array Value asArray(val)

Here you can find the source of asArray(val)

Method Source Code

Array.asArray = function(val){
    if(Array.isArray(val)){
        return val;
    } else {/*from   w  w  w. ja  v a  2s . co m*/
        return [val];
    }
}

Related

  1. unset(value)
    Array.prototype.unset = function (value) {
        if (this.indexOf(value) !== -1) { 
            this.splice(this.indexOf(value), 1);
    };
    
  2. unset(value,isIndex)
    Array.prototype.unset = function(value,isIndex) {
      var isIndex = isIndex || 0;
      if (value == undefined) {
        this.length = 0;
        return this;
      for (var i = 0, j = 0, l = this.length; i < l; ++i) {
        if (!isIndex) {
          if (this[i] != value) { 
    ...
    
  3. unset(value,isIndex)
    Array.prototype.unset = function(value,isIndex) {
      var isIndex = isIndex || 0;
      if (value == undefined) {
        this.length = 0;
        return this;
      for (var i = 0, j = 0, l = this.length; i < l; ++i) {
        if (!isIndex) {
          if (this[i] != value) { 
    ...
    
  4. valueIndexOf(val)
    Array.prototype.valueIndexOf = function(val) {
      for (var i = 0; i < this.length; i++) {
        if (this[i] == val) return i;
      return -1;
    };
    
  5. valuesAt(indices)
    Array.prototype.valuesAt = function(indices) {
      var ary = this;
      return indices.map(function(idx) { return ary[idx] });
    };