Elven Code
These are utility functions that Charlie commonly uses or that he shares with his students.
Usage
import { elfUtils, elfStrings, elfFiles } from 'elven-code';
const { elfUtils, elfStrings, elfFiles } = require('elven-code');
const key = elfStrings.getEndFromCharacter(dir, '/');
const content = elfFiles.readFile(fileName);
console.log(key, content);
Notes
Meant to be used on the server side. Webpack and create-react-app will complain If you target the client. For a solution, see: https://stackoverflow.com/q/64557638/253576.
Install:
npm i elven-code
Testing
To test all the files requires some setup and can best be done on Charlie's machines. In particular, you need:
- ElvenConfig.json in ~/.config
To install the Git Repository called test-dummy:
- git clone https://github.com/charliecalvert/test-dummy.git
- git clone git@github.com:charliecalvert/test-dummy.git
To run all the tests requires setup:
npm test
To run some utils might work without setup:
- npm run test-files
- npm run test-strings
The config file might look like this:
{
"calvert": {
"base-dir": "/home/charlie/",
"site-dirs": [
"Documents/AllTest",
"Git/CloudNotes/Assignments",
"Git/CloudNotes/Prog270",
"Git/CloudNotes/Isit322"
]
}
}
https://www.elvenware.com/teach/assignments/NpmPublishing.html