docs: update README, add some more jsdoc

This commit is contained in:
Andy Burke 2025-07-15 00:15:28 -07:00
parent 22a8b4d03f
commit 55a73c3d0a
10 changed files with 155 additions and 30 deletions

View file

@ -1,3 +1,18 @@
/**
* FSDB Organizer: By Email
*
* Organizes by splitting an email into its components, eg:
*
* com/example.com/soandso@example.com
*
* A symlinking index based on this organizer might look like:
* fsdb root index tld domain email
* [ ][ V ][ V ][ V ][ V ]
* /path/to/db/root/.indexes/email/com/example.com/soandso@example.com
*
* @module
*/
import sanitize from '../utils/sanitize.ts';
const EMAIL_REGEX = /^(?<username>.+)@(?<domain>(?<hostname>.+)\.(?<tld>.+))$/;
@ -16,9 +31,5 @@ export default function by_email(email: string): string[] {
return [];
}
// for example, a symlinking index based on this organizer might look like:
// fsdb root index tld domain email
// [ ][ V ][ V ][ V ][ V ]
// /path/to/db/root/.indexes/email/com/example.com/soandso@example.com
return [sanitize(tld), sanitize(domain), sanitize(email), `${sanitize(email)}.json`];
}