| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/nami/node_modules/prime/collection/ |
Upload File : |
/*
list
- to be used with any object that has a length and numeric keys
- generates generics
*/"use strict"
var shell = require("../util/shell")
// set, get, count, each, map, filter, every, some, index, merge, remove, keys, values
var list = shell({
inherits: require("../es5/array"),
set: function(i, value){
this[i] = value
return this
},
get: function(i){
return (i in this) ? this[i] : null
},
count: function(){
return this.length
},
each: function(method, context){
for (var i = 0, l = this.length; i < l; i++){
if (i in this && method.call(context, i, this[i], this) === false) break
}
return this
},
index: function(value){
var index = list.indexOf(value)
return index == -1 ? null : index
},
remove: function(i){
return list.splice(this, i, 1)[0]
},
keys: function(){
return list.map(this, function(v, i){
return i
})
},
values: function(){
return list.slice(this)
}
})
module.exports = list