vike
Version:
The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.
10 lines (9 loc) • 369 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPropAccessNotation = getPropAccessNotation;
function getPropAccessNotation(key) {
return typeof key === 'string' && isKeyDotNotationCompatible(key) ? `.${key}` : `[${JSON.stringify(key)}]`;
}
function isKeyDotNotationCompatible(key) {
return /^[a-z0-9\$_]+$/i.test(key);
}