Namespace: utils

wp.api. utils

Methods


<static> addMixinsAndHelpers(model, modelClassName, loadingObjects)

Add mixins and helpers to models depending on their defaults.
Parameters:
Name Type Description
model
modelClassName string The classname of the constructed model.
loadingObjects Object An object containing the models and collections we are building.
Source:

<static> camelCaseDashes()

Helper function to camel case the letter after dashes, removing the dashes.
Source:

<static> capitalize()

Helper for capitalizing strings.
Source:

<static> capitalizeAndCamelCaseDashes()

Helper function that capitalizes the first word and camel cases any words starting after dashes, removing the dashes.
Source:

<static> decorateFromRoute(routeEndpoints, modelInstance)

Add args and options to a model prototype from a route's endpoints.
Parameters:
Name Type Description
routeEndpoints array Array of route endpoints.
modelInstance Object An instance of the model (or collection) to add the args to.
Source:

<static> extractParentName(route)

Extract a parent name from a passed route.
Parameters:
Name Type Description
route string The route to extract a name from.
Source:

<static> extractRoutePart(route, part [, versionString] [, reverse])

Extract a route part based on negative index.
Parameters:
Name Type Argument Description
route string The endpoint route.
part int The number of parts from the end of the route to retrieve. Default 1. Example route `/a/b/c`: part 1 is `c`, part 2 is `b`, part 3 is `a`.
versionString string <optional>
Version string, defaults to `wp.api.versionString`.
reverse boolean <optional>
Whether to reverse the order when extracting the route part. Optional, default false.
Source:

<static> getRootUrl()

Helper function for getting the root URL.
Source:
Returns:

<static> parseISO8601()

Parse date into ISO8601 format.
Parameters:
Name Type Description
date. Date
Source: