util/split-path

(require("util/split-path"))(pathStr) → {Array.<String>}

Divide a route string up into hierarchical components by breaking it apart on forward slash characters.

There are plugins (including Jetpack) that register routes with regex capture groups which also contain forward slashes, so those groups have to be pulled out first before the remainder of the string can be .split() as normal.

Source:
Parameters:
Name Type Description
pathStr String

A route path string to break into components

Returns:
Type:
Array.<String>

An array of route component strings