funcity 0.4.0 → 0.5.0

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # funcity
2
2
 
3
- A functional language interpreter with text processing.
3
+ A functional language interpreter with text processing, easy embeddable!
4
4
 
5
5
  ![funcity](./images/funcity.120.png)
6
6
 
@@ -18,7 +18,7 @@ funcity can be considered a type of [text template processor](https://en.wikiped
18
18
  For example, entering code like this:
19
19
 
20
20
  ```funcity
21
- Today is {{if weather.sunny}}nice{{else}}bad{{end}}weather.
21
+ Today is {{if weather.sunny}}nice{{else}}bad{{end}} weather.
22
22
  ```
23
23
 
24
24
  Evaluates the value of the `weather` variable manually bound to the core engine beforehand and generates different text outputs:
@@ -53,7 +53,22 @@ Today is {{printWeather weather}} weather.
53
53
  - `fun` defines an anonymous lambda function.
54
54
  - `set` performs a mutable binding in the current scope.
55
55
 
56
- In other words, funcity is an interpreter that brings the power of functional programming to text template processors, making them easier to handle!
56
+ Furthermore, you can easily integrate this interpreter into your application:
57
+
58
+ ```typescript
59
+ // Input script
60
+ const script = "Today is {{cond weather.sunny ‘nice’ 'bad'}} weather.";
61
+
62
+ // Run the interpreter
63
+ const variables = buildCandidateVariables();
64
+ const errors: FunCityErrorInfo[] = [];
65
+ const text = await runScriptOnce(script, variables, errors);
66
+
67
+ // Display the result text
68
+ console.log(text);
69
+ ```
70
+
71
+ In other words, Funcity is a processing system that brings the power of functional programming to text template processors, enabling seamless integration into applications!
57
72
 
58
73
  ### Features
59
74
 
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * name: funcity
3
+ * version: 0.5.0
4
+ * description: A functional language interpreter with text processing
5
+ * author: Kouji Matsui (@kekyo@mi.kekyo.net)
6
+ * license: MIT
7
+ * repository.url: https://github.com/kekyo/funcity.git
8
+ * git.commit.hash: 68a2ab1ac86b865b1c2ea37aa43816ee34d29540
9
+ */
10
+
11
+ /**
12
+ * Built-in fetch API variables and functions.
13
+ */
14
+ export declare const fetchVariables: Readonly<{
15
+ readonly fetch: (input: unknown, init?: unknown) => Promise<Response>;
16
+ readonly fetchText: (input: unknown, init?: unknown) => Promise<string>;
17
+ readonly fetchJson: (input: unknown, init?: unknown) => Promise<unknown>;
18
+ readonly fetchBlob: (input: unknown, init?: unknown) => Promise<import('node:buffer').Blob>;
19
+ }>;
20
+ //# sourceMappingURL=fetch-variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-variables.d.ts","sourceRoot":"","sources":["../src/fetch-variables.ts"],"names":[],"mappings":";;;;;;;;;AA0CA;;GAEG;AACH,eAAO,MAAM,cAAc;4BAzBE,OAAO,SAAS,OAAO;gCAKnB,OAAO,SAAS,OAAO;gCAKvB,OAAO,SAAS,OAAO;gCAKvB,OAAO,SAAS,OAAO;EAe7C,CAAC"}