The `odata-v4-literal` package is a focused utility designed to convert OData V4 literal values (represented as strings, e.g., `'Hello'`, `123`, `true`, `2023-01-15T10:30:00Z`) into their corresponding native JavaScript data types. This functionality is essential for applications that parse OData query parameters or expressions and need to process the actual values. The package is currently at version 0.1.1, and its last publish date was over nine years ago, indicating that it is effectively abandoned. There is no active development or defined release cadence. Its primary differentiator is providing a direct, simple method for handling the specific syntax and escaping rules of OData V4 primitive literals, which can be complex for types like strings (requiring double single quotes for embedded apostrophes), dates, and GUIDs. Developers should be aware of its unmaintained status when considering its use in new projects.
npm install odata-v4-literalVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `odata-v4-literal` to convert various OData V4 literal string representations into their native JavaScript types, including strings with escaped characters, numbers, booleans, GUIDs, and date/time types. It also shows basic error handling for malformed input.
Consider alternatives for new projects or thoroughly vet the package's stability and compatibility for existing applications. Pin the exact version used to mitigate unexpected behavior if it were to be updated.
Always escape single quotes within OData string literals by doubling them. For example, use `'It''s a test'` instead of `'It's a test'`.
For new projects, seek actively maintained OData V4 parsing libraries. For existing projects, thoroughly test its behavior in your current environment and be prepared for potential incompatibilities with future platform updates.
Ensure you are using `import { Literal } from 'odata-v4-literal';` for ESM or `const { Literal } = require('odata-v4-literal');` for CommonJS to correctly destructure the named export.Review the OData V4 specification for the correct literal format for the EDM type you are trying to convert. Pay close attention to string delimiters (single quotes), date/time formats (ISO 8601), and special character escaping (e.g., doubling single quotes within a string literal).
No dependency data recorded yet.