MCPcopy Index your code
hub / github.com/massCodeIO/massCode / sanitizeCodeEditorSettings

Function sanitizeCodeEditorSettings

src/main/store/module/preferences.ts:97–143  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

95}
96
97function sanitizeCodeEditorSettings(value: unknown): EditorSettings {
98 const source = asRecord(value)
99
100 return {
101 fontSize: readNumber(
102 source,
103 'fontSize',
104 PREFERENCES_DEFAULTS.editor.code.fontSize,
105 ),
106 fontFamily: readString(
107 source,
108 'fontFamily',
109 PREFERENCES_DEFAULTS.editor.code.fontFamily,
110 ),
111 wrap:
112 typeof source.wrap === 'boolean'
113 ? source.wrap
114 : PREFERENCES_DEFAULTS.editor.code.wrap,
115 tabSize: readNumber(
116 source,
117 'tabSize',
118 PREFERENCES_DEFAULTS.editor.code.tabSize,
119 ),
120 trailingComma: readEnum(
121 source,
122 'trailingComma',
123 ['all', 'none', 'es5'] as const,
124 PREFERENCES_DEFAULTS.editor.code.trailingComma,
125 ),
126 semi:
127 typeof source.semi === 'boolean'
128 ? source.semi
129 : PREFERENCES_DEFAULTS.editor.code.semi,
130 singleQuote:
131 typeof source.singleQuote === 'boolean'
132 ? source.singleQuote
133 : PREFERENCES_DEFAULTS.editor.code.singleQuote,
134 highlightLine:
135 typeof source.highlightLine === 'boolean'
136 ? source.highlightLine
137 : PREFERENCES_DEFAULTS.editor.code.highlightLine,
138 matchBrackets:
139 typeof source.matchBrackets === 'boolean'
140 ? source.matchBrackets
141 : PREFERENCES_DEFAULTS.editor.code.matchBrackets,
142 }
143}
144
145function sanitizeNotesEditorSettings(value: unknown): NotesEditorSettings {
146 const source = asRecord(value)

Callers 1

sanitizePreferencesFunction · 0.85

Calls 4

asRecordFunction · 0.90
readNumberFunction · 0.90
readStringFunction · 0.90
readEnumFunction · 0.90

Tested by

no test coverage detected