UNPKG

@scalar/oas-utils

Version:

Open API spec and Yaml handling utilities

11 lines (8 loc) 289 B
import { REGEX } from './regex-helpers.js'; /** * Find all strings wrapped in {} or {{}} in value. */ const findVariables = (value) => { return [...value.matchAll(REGEX.PATH), ...value.matchAll(REGEX.VARIABLES)].map((match) => match[1]?.trim()) || []; }; export { findVariables };