UNPKG

@inlang/paraglide-js

Version:

[![NPM Downloads](https://img.shields.io/npm/dw/%40inlang%2Fparaglide-js?logo=npm&logoColor=red&label=npm%20downloads)](https://www.npmjs.com/package/@inlang/paraglide-js) [![GitHub Issues](https://img.shields.io/github/issues-closed/opral/paraglide-js?lo

15 lines 515 B
import { escapeForDoubleQuoteString } from "../services/codegen/escape.js"; const identifierPattern = /^[A-Za-z_$][A-Za-z0-9_$]*$/; export function isValidIdentifier(name) { return identifierPattern.test(name); } export function quotePropertyKey(name) { return `"${escapeForDoubleQuoteString(name)}"`; } export function compileInputAccess(name) { if (isValidIdentifier(name)) { return `i?.${name}`; } return `i?.[${quotePropertyKey(name)}]`; } //# sourceMappingURL=variable-access.js.map