all files / common/util/ HtmlUtils.ts

100% Statements 11/11
75% Branches 3/4
66.67% Functions 2/3
100% Lines 10/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25                             
/*
 *  @license
 *  Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
 *
 *  Use of this source code is governed by an Apache-2.0 license that can be
 *  found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
 */
 
export class HtmlUtils {
 
    public static getEncodedURIComponent(jsonObjParameters: any): string {
        if (jsonObjParameters) {
            const params: string[] = [];
            for (const p in jsonObjParameters) {
                Eif (jsonObjParameters.hasOwnProperty(p)) {
                    params.push(`${encodeURIComponent(p)}=${encodeURIComponent(jsonObjParameters[p])}`);
                }
            }
            return params.join('&');
        }
        return '';
    }
}