UNPKG

@datadog/mobile-react-native-code-push

Version:

A client-side React Native module to interact with Appcenter Codepush and Datadog

38 lines (34 loc) 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.removeDiscardProperties = exports.DISCARD_PROPERTY = void 0; /* * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2016-Present Datadog, Inc. */ /** * A constant used to define a property that should be discarded from a {@link RequiredOrDiscard} object. */ const DISCARD_PROPERTY = exports.DISCARD_PROPERTY = { _dd_meta_: 'DISCARD' }; /** * Used to change the type of every property of an object to be either required or {@link DISCARD_PROPERTY}. */ /** * Removes all entries of value {@link DISCARD_PROPERTY} from the given object * @param obj The object to remove the {@link DISCARD_PROPERTY} entries from. * @returns The object without the {@link DISCARD_PROPERTY} entries. */ const removeDiscardProperties = obj => { const result = {}; Object.keys(obj).forEach(key => { const value = obj[key]; result[key] = value === DISCARD_PROPERTY ? undefined : value; }); return result; }; exports.removeDiscardProperties = removeDiscardProperties; //# sourceMappingURL=utils.js.map