UNPKG

lux-framework

Version:

Build scalable, Node.js-powered REST APIs with almost no code.

17 lines (13 loc) 418 B
// @flow import { DYNAMIC_PATTERN } from '../constants'; import insert from '../../../../utils/insert'; /** * @private */ export default function getDynamicSegments(path: string) { const matches = path.match(DYNAMIC_PATTERN) || []; const dynamicSegments = new Array(matches.length); insert(dynamicSegments, matches.map(part => part.substr(1))); Object.freeze(dynamicSegments); return dynamicSegments; }