npm.io
4.14.2 • Published 3 years ago

elven-code

Licence
MIT
Version
4.14.2
Deps
6
Size
124 kB
Vulns
1
Weekly
0

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:

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

Keywords