UNPKG

@datadog/mobile-react-native

Version:

A client-side React Native module to interact with Datadog

35 lines (32 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateContext = void 0; var _InternalLog = require("../InternalLog"); var _SdkVerbosity = require("../SdkVerbosity"); /* eslint-disable @typescript-eslint/ban-ts-comment */ /* * 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. */ const validateContext = context => { if (!context) { return {}; } // eslint-disable-next-line eqeqeq if (context.constructor == Object) { return context; } if (Array.isArray(context)) { _InternalLog.InternalLog.log("The given context is an array, it will be nested in 'context' property inside a new object.", _SdkVerbosity.SdkVerbosity.WARN); return { context }; } _InternalLog.InternalLog.log(`The given context (${context}) is invalid - it must be an object. Context will be empty.`, _SdkVerbosity.SdkVerbosity.ERROR); return {}; }; exports.validateContext = validateContext; //# sourceMappingURL=argsUtils.js.map