How to use the core-js/library/fn/object/entries function in core-js

To help you get started, we’ve selected a few core-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bigchaindb / js-bigchaindb-driver / src / sanitize.js View on Github external
function applyFilterOnObject(obj, filterFn) {
    if (filterFn == null) {
        return Object.assign({}, obj)
    }

    const filteredObj = {}
    coreObjectEntries(obj).forEach(([key, val]) => {
        if (filterFn(val, key)) {
            filteredObj[key] = val
        }
    })

    return filteredObj
}
github bigchaindb / js-bigchaindb-driver / src / stringify_as_query_param.js View on Github external
export default function stringifyAsQueryParam(obj, transform = decamelize) {
    if (!obj || typeof obj !== 'object' || !Object.keys(obj).length) {
        return ''
    }

    const transformedKeysObj = coreObjectEntries(obj).reduce((paramsObj, [key, value]) => {
        paramsObj[transform(key)] = value
        return paramsObj
    }, {})

    return `?${queryString.stringify(transformedKeysObj)}`
}