403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/bitnami/nami/node_modules/prime/collection/map.js
/*
map
 - must be instantiated
*/"use strict"

var prime = require("../prime"),
	array = require("../es5/array"),
	proto = array.prototype

// set, get, count, each, map, filter, some, every, index, remove, keys, values

var Map = prime({

	constructor: function(){
		if (!(this instanceof Map)) return new Map
		this.length = 0
		this._keys = []
		this._values = []
	},

	set: function(key, value){
		var index = proto.indexOf.call(this._keys, key)

		if (index === -1){
			this._keys[this.length] = key
			this._values[this.length] = value
			this.length++
		} else {
			this._values[index] = value
		}

		return this
	},

	get: function(key){
		var index = proto.indexOf.call(this._keys, key)
		return (index === -1) ? null : this._values[index]
	},

	count: function(){
		return this.length
	},

	each: function(method, context){
		for (var i = 0, l = this.length; i < l; i++){
			if (method.call(context, this._values[i], this._keys[i], this) === false) break
		}
		return this
	},

	map: function(method, context){
		var results = new Map
		this.each(function(value, key){
			results.set(key, method.call(context, value, key, this))
		}, this)
		return results
	},

	filter: function(method, context){
		var results = new Map
		this.each(function(value, key){
			results.set(key, method.call(context, value, key, this))
		}, this)
		return results
	},

	every: function(method, context){
		var every = true
		this.each(function(value, key){
			if (!method.call(context, value, key, this)) return every = false
		}, this)
		return every
	},

	some: function(method, context){
		var some = false
		this.each(function(value, key){
			if (method.call(context, value, key, this)) return !(some = true)
		}, this)
		return some
	},

	index: function(value){
		var index = proto.indexOf.call(this._values, value)
		return (index > -1) ? this._keys[index] : null
	},

	remove: function(key){
		var index = proto.indexOf.call(this._keys, key)

		if (index !== -1){
			this._keys.splice(index, 1)
			return this._values.splice(index, 1)[0]
			this.length--
		}

		return null
	},

	keys: function(){
		return this._keys.slice()
	},

	values: function(){
		return this._values.slice()
	},

	toString: function(){
		return "[object Map]"
	}

})

module.exports = Map

Youez - 2016 - github.com/yon3zu
LinuXploit