MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getFile

Function getFile

src/lib/editorManager.js:3008–3024  ·  view source on GitHub ↗

* Gets a file from the file manager * @param {string|number} checkFor * @param {"id"|"name"|"uri"} [type] * @returns {File}

(checkFor, type = "id")

Source from the content-addressed store, hash-verified

3006 * @returns {File}
3007 */
3008 function getFile(checkFor, type = "id") {
3009 return manager.files.find((file) => {
3010 switch (type) {
3011 case "id":
3012 if (file.id === checkFor) return true;
3013 return false;
3014 case "name":
3015 if (file.filename === checkFor) return true;
3016 return false;
3017 case "uri":
3018 if (file.uri === checkFor) return true;
3019 return false;
3020 default:
3021 return false;
3022 }
3023 });
3024 }
3025
3026 /**
3027 * Gets the height of the editor

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected