Gathering detailed insights and metrics for @crabas0npm/optio-cupiditate-quisquam
Gathering detailed insights and metrics for @crabas0npm/optio-cupiditate-quisquam
npm install @crabas0npm/optio-cupiditate-quisquam
Typescript
Module System
Node Version
NPM Version
54.5
Supply Chain
48.1
Quality
75.5
Maintenance
100
Vulnerability
100
License
Cumulative downloads
Total Downloads
Last day
0%
0
Compared to previous day
Last week
0%
0
Compared to previous week
Last month
0%
0
Compared to previous month
Last year
0%
0
Compared to previous year
33
A template parser in Node.js that supports replacers and functions. Allows users to use custom outputs and access functions and variables in a custom template file.
npm install @crabas0npm/optio-cupiditate-quisquam
Note: An update has been planned to remove the need to explicitly declare if the file is CRLF or LF break files!
1const @crabas0npm/optio-cupiditate-quisquam = require('@crabas0npm/optio-cupiditate-quisquam');
New()
is the main class, create a new instance of this!
The instance of @crabas0npm/optio-cupiditate-quisquam has three main functions, two of them registering variables and functions, the third being the executer.
RegisterVariable
- Takes in two strings, the first is the replacer(or tag) and the second is the "to be replaced".
RegisterFunction
- Takes in a string and a function, the first one being the tag, the second one being the function that can be executed.
Execute
- Takes a string and writer(a function/method), the string template is parsed. Any regular strings that are not variable/function tags will be executed by the writer. Variable tags will be replaced and functions will be executed with respect to the parameters that were provided in the string template.
1const @crabas0npm/optio-cupiditate-quisquam = require('@crabas0npm/optio-cupiditate-quisquam'); 2var registry = new @crabas0npm/optio-cupiditate-quisquam.New(); 3 4registry.RegisterVariable("foo", "bar"); 5registry.RegisterFunction("sleep", 6 function(delayInms){ 7 return new Promise(resolve => setTimeout(resolve, delayInms)); 8 } 9); 10 11var string = 12`<<sleep(1000)>>that was 1 second 13<<sleep(5000)>>that was 5 seconds 14<<$foo>> <- this is a variable replacer!`;
Also known as CRLF, this is what most files @crabas0npm/optio-cupiditate-quisquam is supposedly parsing, files are expected to have \r\n
at the end of each line. This mode will not add a carriage return \r
at the end of each line.
1const @crabas0npm/optio-cupiditate-quisquam = require('@crabas0npm/optio-cupiditate-quisquam'); 2var registry = new @crabas0npm/optio-cupiditate-quisquam.New();
Also known as LF, these type of files do not have a carriage return character at the end of each line(\r
). A \r
character will be added to the end of every line. This is used to handle the issue where everything is output in 1 line by the writer.
1const @crabas0npm/optio-cupiditate-quisquam = require('@crabas0npm/optio-cupiditate-quisquam'); 2var registry = new @crabas0npm/optio-cupiditate-quisquam.New(null, true);
Using a custom splitter that isn't the default <<
, >>
.
1// custom splitter 2const @crabas0npm/optio-cupiditate-quisquam = require('@crabas0npm/optio-cupiditate-quisquam'); 3var registry = new @crabas0npm/optio-cupiditate-quisquam.New(["[[", "]]"], true); 4// E.g. This will now allow you to use [[$tag]] instead of <<$tag>>
Copyright Apache 2.0 License © 2022 Jeffplays2005.
No vulnerabilities found.
No security vulnerabilities found.