@microsoft/kiota-abstractions
Version:
Core abstractions for kiota generated libraries in TypeScript and JavaScript
28 lines • 1.1 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 UntypedNode instance is an UntypedArray.
* @param node The UntypedNode to check.
* @returns boolean indicating if the node is an UntypedArray.
*/
export const isUntypedArray = (node) => {
const proposedNode = node;
return proposedNode && proposedNode.value instanceof Array && proposedNode.value.every((item) => isUntypedNode(item));
};
/**
* Factory to create an UntypedArray from an array of UntypedNodes.
* @param value The value to create from.
* @returns The created UntypedArray.
*/
export const createUntypedArray = (value) => {
return {
value,
getValue: () => value,
};
};
//# sourceMappingURL=untypedArray.js.map