All files / wdclib Enums.js

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104  1x                                                                                                                                                                                                   1x 12x      
/** This file lists all of the enums which should available for the WDC */
export const ENUMS_DICTIONARY = {
    phaseEnum: {
        interactivePhase: 'interactive',
        authPhase: 'auth',
        gatherDataPhase: 'gatherData'
    },
 
    authPurposeEnum: {
        ephemeral: 'ephemeral',
        enduring: 'enduring'
    },
 
    authTypeEnum: {
        none: 'none',
        basic: 'basic',
        custom: 'custom'
    },
 
    dataTypeEnum: {
        bool: 'bool',
        date: 'date',
        datetime: 'datetime',
        float: 'float',
        int: 'int',
        string: 'string',
        geometry: 'geometry'
    },
 
    columnRoleEnum: {
        dimension: 'dimension',
        measure: 'measure'
    },
 
    columnTypeEnum: {
        continuous: 'continuous',
        discrete: 'discrete'
    },
 
    aggTypeEnum: {
        sum: 'sum',
        avg: 'avg',
        median: 'median',
        count: 'count',
        countd: 'count_dist'
    },
 
    geographicRoleEnum: {
        area_code: 'area_code',
        cbsa_msa: 'cbsa_msa',
        city: 'city',
        congressional_district: 'congressional_district',
        country_region: 'country_region',
        county: 'county',
        state_province: 'state_province',
        zip_code_postcode: 'zip_code_postcode',
        latitude: 'latitude',
        longitude: 'longitude'
    },
 
    unitsFormatEnum: {
        thousands: 'thousands',
        millions: 'millions',
        billions_english: 'billions_english',
        billions_standard: 'billions_standard'
    },
 
    numberFormatEnum: {
        number: 'number',
        currency: 'currency',
        scientific: 'scientific',
        percentage: 'percentage'
    },
 
    localeEnum: {
        america: 'en-us',
        brazil: 'pt-br',
        china: 'zh-cn',
        france: 'fr-fr',
        germany: 'de-de',
        japan: 'ja-jp',
        korea: 'ko-kr',
        spain: 'es-es'
    },
 
    joinEnum: {
        inner: 'inner',
        left: 'left'
    }
};
 
/**
 * Applies the enums as properties of the target object
 * this is a mixin ( will overwrite existing properties)
 *
 * @param {Object} target
 * @returns {Undefined}
 */
export function applyEnums (target) {
    for (let key in ENUMS_DICTIONARY) {
        target[key] = ENUMS_DICTIONARY[key];
    }
}