Skip to main content

Function: sanitiseProfiles()

sanitiseProfiles(input, author?): ProfileGraph[] | undefined

Defined in: src/lib/classes/ProfileGraphs/index.ts:68

Keep only valid profile graphs from an untrusted value (e.g. stored or imported): each with an ID and name and valid points (see sanitisePoints), each ID once and none of the presets', up to MAX_SAVED_PROFILES. Graphs of version 1 are upgraded (see upgradeAsset). An invalid author is replaced with author, and an invalid group or version is left out. Undefined if the value isn't an array.

Parameters​

input​

unknown

author?​

AssetAuthor = UNKNOWN_AUTHOR

the author of graphs with none or an invalid one

Returns​

ProfileGraph[] | undefined

Example​

sanitiseProfiles([graph, { ...graph, name: "Again" }]); // the first