%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/var/www/html/ppaobm/vendor/bower-asset/fullcalendar/src/core/util/ |
Upload File : |
// Merges an array of objects into a single object.
// The second argument allows for an array of property names who's object values will be merged together.
export function mergeProps(propObjs, complexProps?): any {
let dest = {}
let i
let name
let complexObjs
let j
let val
let props
if (complexProps) {
for (i = 0; i < complexProps.length; i++) {
name = complexProps[i]
complexObjs = []
// collect the trailing object values, stopping when a non-object is discovered
for (j = propObjs.length - 1; j >= 0; j--) {
val = propObjs[j][name]
if (typeof val === 'object' && val) { // non-null object
complexObjs.unshift(val)
} else if (val !== undefined) {
dest[name] = val // if there were no objects, this value will be used
break
}
}
// if the trailing values were objects, use the merged value
if (complexObjs.length) {
dest[name] = mergeProps(complexObjs)
}
}
}
// copy values into the destination, going from last to first
for (i = propObjs.length - 1; i >= 0; i--) {
props = propObjs[i]
for (name in props) {
if (!(name in dest)) { // if already assigned by previous props or complex props, don't reassign
dest[name] = props[name]
}
}
}
return dest
}
export function filterHash(hash, func) {
let filtered = {}
for (let key in hash) {
if (func(hash[key], key)) {
filtered[key] = hash[key]
}
}
return filtered
}
export function mapHash<InputItem, OutputItem>(
hash: { [key: string]: InputItem },
func: (input: InputItem, key: string) => OutputItem
): { [key: string]: OutputItem } {
let newHash = {}
for (let key in hash) {
newHash[key] = func(hash[key], key)
}
return newHash
}
export function arrayToHash(a): { [key: string]: true } {
let hash = {}
for (let item of a) {
hash[item] = true
}
return hash
}
export function hashValuesToArray(obj) {
let a = []
for (let key in obj) {
a.push(obj[key])
}
return a
}