@microsoft/kiota-abstractions
Version:
Core abstractions for kiota generated libraries in TypeScript and JavaScript
28 lines • 1.19 kB
JavaScript
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
import { isUntypedNode } from "./untypedNode.js";
/**
* Type guard to assert that an object instance is an UntypedObject.
* @param node The object to check.
* @returns boolean indicating if the node is an UntypedObject.
*/
export const isUntypedObject = (node) => {
const proposedNode = node;
return proposedNode && proposedNode.value instanceof Object && proposedNode.value instanceof Array === false && Object.values(proposedNode.value).every((item) => isUntypedNode(item));
};
/**
* Factory to create an UntypedObject from a Record<string, UntypedNode>.
* @param value The Record<string, UntypedNode> value to create from.
* @returns The created UntypedObject.
*/
export const createUntypedObject = (value) => {
return {
value,
getValue: () => value,
};
};
//# sourceMappingURL=untypedObject.js.map