tokeniser

0.0.3 • Public • Published

README

Dynamic file contents and string manipulation in node.js utilising inline token strings.

NPM doc gen scripts, Only works in unix cmd with find. npm run docs

Purpose

  • Allows for the manipulation of a files contents
  • Allows for the manipulation of a string
  • Utilises inline tokens of the format <!prefix.token.name!>
  • Three types of tokens:
    • Singular <!prefix.token.name!>
    • Singular with value <!prefix.token.name value=aRandomValue!>
    • Encapsulated:
<!prefix.token.name id=givenIdString!> 
content encapsulated within token 
<!prefix.token.name.givenIdString#!>

Tokens

Singular Tokens

  • Used as markers within a file or string that can programmaticaly be replaced with content
  • Instead of straight replacing with content, it can be specified to keep the token inplace after the content
  • They can have a simple value added to them, which will replace the token upon a clean operation

Encapsulated Tokens

  • Used to contain blocks of content
  • Encapsulated tokens can be inserted inplace of an existing token, or be specified to be placed before / after an existing encapsulation token
  • Upon cleanUp operation, the encapsulated token part are removed and it's content is left inplace

Other Functionalities

  • List all tokens, or list all tokens of a specific type
  • CleanUp operation:
    • Remove all singular tokens
    • Replace singular tokens that have a value, for their value
    • Remove parts of an encapsulated token and leave inplace its value
  • get contents of an encapsulated token
  • get value assigned to a singular token

TODO

  • allow for new file to be specified on clean-up operation that will leave the token bearing template untouched
  • in list object allow for encapsulations of same token name to be ordered through exposed methods

Package Sidebar

Install

npm i tokeniser

Weekly Downloads

0

Version

0.0.3

License

ISC

Last publish

Collaborators

  • fruityfreedom