0.0.4 • Published 3 years ago

@t360/core v0.0.4

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
3 years ago

Core

This holds the libraries that can be used by the browser or the CLI app to access entity files

Usage

The main methods are

let makeContext: MakeContext = (contextDetails: ContextDetails) => Context
let makeJsonFromId = (id: string) => (context: Context) => Promise<string>

Context details are the 'stuff' that configures how everything works

export interface ContextDetails{
    entityMod: number
    root: string,
    files: Files,
    findSha: FindSha,
    output: (s: string)=>void
}
  • entityMod is a 'magic number' used in the id extraction. Each of the import configurations could have a different value. It is used in the calculation of ID => Filename.
  • root is the root directory that the entitylist files are stored
  • files is a interface with (currently) one method on it: it's how the file should be read. The default implementation uses node's 'fs'. It can easily be replaced with an api call
  • findSha is 'how do we calculate the digest'. The default implementation uses node's crypto, but that can be changed
  • output is used by the CLI. It is how we write to the console. Dependency injected because global variables/singletons like console.log are bad
0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago