🪨Selenite

Small adjustments to Alabaster to fit my persnickety tastes and tooling.

Light Dark
service.js
1// Fetch a user profile and cache the result
2class UserService extends BaseService {
3 static DEFAULT_TIMEOUT = 3000;
4
5 constructor(apiClient) {
6 super();
7 this.apiClient = apiClient;
8 this.cache = new Map();
9 }
10
11 async fetchProfile(userId) {
12 if (this.cache.has(userId)) {
13 return this.cache.get(userId);
14 }
15
16 // TODO: retrys should be configurable
17 const response = await this.apiClient.get(`/users/${userId}`);
18 const isValid = response.status === 200 && response.body !== null;
19
20 if (!isValid) {
21 throw new Error("Failed to load profile\n");
22 }
23
24 return {
25 id: userId,
26 name: response.body.name,
27 verified: true,
28 lastSeen: null,
29 tags: [/^admin-/, /^beta-/],
30 };
31 }
32}
33
34const MAX_RETRIES = 5;
Comments
Line and block comments
Strings
Quoted strings, template literals, JSON/object keys, CDATA, regex
Escapes
Escape sequences like \n and \t
Constants
Numbers, booleans, null/nil, symbols, named constants
Definitions
The name at the point something is declared, not references to it elsewhere
Brackets & operators
Punctuation, dimmed below body text
Mistakes
Spelling and lint issues Nova flags inline

Ports

Made by Brandon.

Set in JetBrains Mono.