Completed
Push — master ( a4aa47...fee80d )
by Vitaly
01:55
created

uri.js ➔ query   B

Complexity

Conditions 6
Paths 3

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
c 0
b 0
f 0
nc 3
nop 1
dl 0
loc 8
rs 8.8571
1
import { join as pathJoin } from 'path';
2
3
export function join(...args) {
4
5
    args = args.filter( arg => arg === 0 || Boolean(arg) ).map(String);
6
    return args.length ? `${pathJoin(...args)}` : '/';
7
}
8
9
export function query(queryObject) {
10
    for (let param in queryObject) {
11
        if (queryObject.hasOwnProperty(param) && (queryObject[param] === undefined || queryObject[param] === '' || queryObject[param] === null) ) {
12
            delete queryObject[param];
13
        }
14
    }
15
    return queryObject;
16
}