3.14.123 • Published 10 months ago

@diotoborg/placeat-ea-autem v3.14.123

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Termfx JS

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 version install size

npm.io

Table of contents:

Installation

npm install @diotoborg/placeat-ea-autem

Usage

Note: An update has been planned to remove the need to explicitly declare if the file is CRLF or LF break files!

const @diotoborg/placeat-ea-autem = require('@diotoborg/placeat-ea-autem');

New() is the main class, create a new instance of this! The instance of @diotoborg/placeat-ea-autem 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.

Examples:

const @diotoborg/placeat-ea-autem = require('@diotoborg/placeat-ea-autem');
var registry = new @diotoborg/placeat-ea-autem.New();

registry.RegisterVariable("foo", "bar");
registry.RegisterFunction("sleep",
  function(delayInms){
    return new Promise(resolve => setTimeout(resolve, delayInms));
  }
);

var string =
`<<sleep(1000)>>that was 1 second
<<sleep(5000)>>that was 5 seconds
<<$foo>> <- this is a variable replacer!`;

Carriage Return Line Feed Files

Also known as CRLF, this is what most files @diotoborg/placeat-ea-autem 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.

const @diotoborg/placeat-ea-autem = require('@diotoborg/placeat-ea-autem');
var registry = new @diotoborg/placeat-ea-autem.New();

Line feed

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.

const @diotoborg/placeat-ea-autem = require('@diotoborg/placeat-ea-autem');
var registry = new @diotoborg/placeat-ea-autem.New(null, true);

Custom splitter

Using a custom splitter that isn't the default <<, >>.

// custom splitter
const @diotoborg/placeat-ea-autem = require('@diotoborg/placeat-ea-autem');
var registry = new @diotoborg/placeat-ea-autem.New(["[[", "]]"], true);
// E.g. This will now allow you to use [[$tag]] instead of <<$tag>>

Bugs or suggestions

  • Please report any bugs or provide suggestions in the github!

License

Copyright Apache 2.0 License © 2022 Jeffplays2005.

3.14.123

10 months ago

3.13.103

11 months ago

3.13.102

11 months ago

3.13.101

11 months ago

3.13.100

11 months ago

3.13.107

10 months ago

3.13.106

10 months ago

3.13.105

10 months ago

3.13.104

11 months ago

3.11.64

12 months ago

3.11.63

12 months ago

3.13.109

10 months ago

3.11.66

12 months ago

3.13.108

10 months ago

3.11.65

12 months ago

3.11.68

12 months ago

3.11.67

12 months ago

3.7.39

1 year ago

3.11.69

12 months ago

3.11.60

12 months ago

3.11.62

12 months ago

3.11.61

12 months ago

3.13.110

10 months ago

3.13.114

10 months ago

3.13.113

10 months ago

3.13.112

10 months ago

3.13.111

10 months ago

3.7.42

1 year ago

3.13.115

10 months ago

3.13.98

11 months ago

3.11.75

12 months ago

3.13.99

11 months ago

3.11.74

12 months ago

3.11.77

11 months ago

3.11.76

12 months ago

3.11.79

11 months ago

3.11.78

11 months ago

3.13.92

11 months ago

3.13.93

11 months ago

3.14.122

10 months ago

3.13.94

11 months ago

3.11.71

12 months ago

2.6.26

1 year ago

3.14.121

10 months ago

3.13.95

11 months ago

3.11.70

12 months ago

2.6.27

1 year ago

3.13.96

11 months ago

3.11.73

12 months ago

2.6.28

1 year ago

3.13.97

11 months ago

3.11.72

12 months ago

2.6.29

1 year ago

3.7.40

1 year ago

2.6.22

1 year ago

3.7.41

1 year ago

2.6.23

1 year ago

2.6.24

1 year ago

2.6.25

1 year ago

3.11.49

1 year ago

3.11.48

1 year ago

3.12.90

11 months ago

3.12.92

11 months ago

3.12.91

11 months ago

2.6.37

1 year ago

2.6.38

1 year ago

2.6.33

1 year ago

2.6.34

1 year ago

2.6.35

1 year ago

2.6.36

1 year ago

2.6.30

1 year ago

2.6.31

1 year ago

2.6.32

1 year ago

3.9.48

1 year ago

3.9.46

1 year ago

3.9.47

1 year ago

3.9.44

1 year ago

3.9.45

1 year ago

3.11.53

1 year ago

3.11.52

1 year ago

3.11.55

1 year ago

3.11.54

1 year ago

3.11.57

12 months ago

3.11.56

1 year ago

3.11.59

12 months ago

3.11.58

12 months ago

3.11.51

1 year ago

1.4.11

1 year ago

3.11.50

1 year ago

1.4.10

1 year ago

3.9.42

1 year ago

3.9.43

1 year ago

1.4.12

1 year ago

3.8.42

1 year ago

3.12.87

11 months ago

3.12.86

11 months ago

3.12.89

11 months ago

3.12.88

11 months ago

2.7.39

1 year ago

2.7.38

1 year ago

3.11.86

11 months ago

3.11.85

11 months ago

3.14.120

10 months ago

3.14.115

10 months ago

3.14.117

10 months ago

3.11.80

11 months ago

3.14.116

10 months ago

3.11.82

11 months ago

3.11.81

11 months ago

3.11.84

11 months ago

1.5.12

1 year ago

3.11.83

11 months ago

1.5.14

1 year ago

2.5.22

1 year ago

1.5.13

1 year ago

1.5.16

1 year ago

1.5.15

1 year ago

3.14.119

10 months ago

1.5.18

1 year ago

3.14.118

10 months ago

1.5.17

1 year ago

1.5.19

1 year ago

3.10.48

1 year ago

1.5.21

1 year ago

1.5.20

1 year ago

1.4.9

1 year ago

1.4.8

1 year ago

1.5.22

1 year ago

1.4.7

1 year ago

1.4.6

1 year ago

1.4.5

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago