-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
enhancementNew feature or requestNew feature or request
Description
util.format
Supports %s C style replacement but JavaScript itself supports template literals which are clearer to see the expected output and don't need an import.
A function can be used for composure.
const journeyURLTemplate =
'%s/json%s/realm-config/authentication/authenticationtrees/trees/%s';
const nodeURLTemplate =
'%s/json%s/realm-config/authentication/authenticationtrees/nodes/%s/%s';
// five minutes later
const urlString = util.format(
queryAllTreesURLTemplate,
storage.session.getTenant(),
getCurrentRealmPath()
);
const response = await generateAmApi(getTreeApiConfig())
.get(urlString, {
withCredentials: true,
})Becomes
const journeyURLTemplate = ({ host, treename }) => `${host}/json%s/realm-config/authentication/authenticationtrees/trees/${treename}`;
const nodeURLTemplate = ({host, something, somethingElse}) => `${host}/json%s/realm-config/authentication/authenticationtrees/nodes/${something}/${somethingElse}`;
const response = await generateAmApi(getTreeApiConfig())
.get(journeyURLTemplate({ host, treename }), {
withCredentials: true,
})Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request