MCPcopy Create free account
hub / github.com/violentmonkey/violentmonkey / normalizePosition

Function normalizePosition

src/background/utils/db.js:221–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

219
220/** @return {Promise<boolean>} */
221export async function normalizePosition() {
222 const updates = aliveScripts.reduce((res, script, index) => {
223 const { props } = script;
224 const position = index + 1;
225 if (props.position !== position) {
226 props.position = position;
227 (res || (res = {}))[props.id] = script;
228 }
229 return res;
230 }, null);
231 maxScriptPosition = aliveScripts.length;
232 if (updates) {
233 await storage[S_SCRIPT].set(updates);
234 updateLastModified();
235 }
236 return !!updates;
237}
238
239/** @return {Promise<Boolean>} */
240export async function sortScripts() {

Callers 2

MoveFunction · 0.85
sortScriptsFunction · 0.85

Calls 2

updateLastModifiedFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected