3xpr 1.15.23 → 1.15.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +29 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -104,6 +104,35 @@ while (p=timezones.pop()) {
104
104
  // {"name":"Madrid","offset":1,"pos":{"lat":40.4,"log":-3.7}}
105
105
  ```
106
106
 
107
+ ## Extend
108
+
109
+ You can extend the library by adding enums, constants, formats, operators, and functions.
110
+ To do this, use the following functions:
111
+
112
+ - **AddConstant**: Adds a constant to the library.
113
+ - **AddEnum**: Adds an enumeration to the library.
114
+ - **AddFormat**: Adds a format to the library.
115
+ - **AddOperator**: Adds an operator to the library.
116
+ - **AddFunction**: Adds a function to the library.
117
+
118
+ ### Example
119
+
120
+ ```typescript
121
+ import { expressions as exp } from '3xpr'
122
+ const CryptoJS = require('crypto-js')
123
+
124
+ exp.addFunction(
125
+ 'encrypt(value:string):string',
126
+ (value: string, key:string):string => CryptoJS.AES.encrypt(value, key).toString(),
127
+ { description: 'Encrypt a string' }
128
+ )
129
+ exp.addFunction(
130
+ 'decrypt(value:string):string',
131
+ (value: string, key:string):string => CryptoJS.AES.decrypt(value, key).toString(CryptoJS.enc.Utf8),
132
+ { description: 'Decrypt a string' }
133
+ )
134
+ ```
135
+
107
136
  ## Related projects
108
137
 
109
138
  - [typ3s](https://www.npmjs.com/package/typ3s)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3xpr",
3
- "version": "1.15.23",
3
+ "version": "1.15.25",
4
4
  "description": "expressions",
5
5
  "author": "Flavio Lionel Rita <flaviolrita@hotmail.com>",
6
6
  "license": "Apache-2.0 License",