@microsoft/kiota-abstractions
Version:
Core abstractions for kiota generated libraries in TypeScript and JavaScript
47 lines • 1.81 kB
JavaScript
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* Factory to create an UntypedNode from a string during deserialization.
* @param _parseNode The ParseNode to deserialize.
* @returns A function that can deserialize an UntypedNode.
*/
export const createUntypedNodeFromDiscriminatorValue = (_parseNode) => {
return deserializeIntoUntypedNode;
};
/**
* Type guard to assert that an object instance is an UntypedNode.
* @param node The object to check.
* @returns boolean indicating if the node is an UntypedNode.
*/
export const isUntypedNode = (node) => {
const potentialNode = node;
return (potentialNode === null || potentialNode === void 0 ? void 0 : potentialNode.getValue) !== undefined;
};
/**
* The deserialization implementation for UntypedNode.
* @param untypedNode - The UntypedNode to deserialize.
* @returns A function that can deserialize a ParseNode into the provided UntypedNode.
*/
export const deserializeIntoUntypedNode = (untypedNode = {}) => {
return {
value: (_n) => {
untypedNode.value = null;
},
getValue: (_n) => {
untypedNode.getValue = () => untypedNode.value;
},
};
};
/**
* The serialization implementation for UntypedNode.
* @param _writer - The serialization writer to use.
* @param _errorDetails - The error details to include in the serialization.
*/
export const serializeUntypedNode = (_writer, _errorDetails = {}) => {
return;
};
//# sourceMappingURL=untypedNode.js.map