yini-parser 1.0.0-alpha.7 → 1.0.0-beta.1

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.
@@ -0,0 +1,11 @@
1
+ @yini
2
+
3
+ ^ App
4
+ title = 'My App'
5
+ items = 10
6
+ debug = ON
7
+
8
+ ^ Server
9
+ host = "localhost"
10
+ port = 8080
11
+ useTLS = OFF
@@ -0,0 +1,89 @@
1
+ # YINI vs JSON, YAML, INI, and TOML
2
+
3
+ This document shows how the same configuration would look in different formats.
4
+
5
+ It highlights YINI's goal: *clean, human-friendly config syntax* - with full support for nesting, comments, and typed values - while remaining simpler than YAML or JSON.
6
+
7
+ ---
8
+
9
+ ## 🔵 YINI
10
+
11
+ This example shows how YINI compares to other formats for common configuration needs.
12
+
13
+ ```yini
14
+ @yini
15
+
16
+ ^ App
17
+ name = 'Demo App'
18
+ items = 25
19
+ darkMode = true
20
+
21
+ ^^ Special
22
+ color = #336699
23
+ isCaching = false
24
+ ```
25
+
26
+ ## 🟠 JSON
27
+
28
+ ```json
29
+ {
30
+ "App": {
31
+ "name": "Demo App",
32
+ "items": 25,
33
+ "darkMode": true,
34
+ "Special": {
35
+ "color": 3368601,
36
+ "isCaching": false
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## 🟡 YAML
43
+
44
+ ```yaml
45
+ App:
46
+ name: "Demo App"
47
+ items: 25
48
+ darkMode: true
49
+ Special:
50
+ color: 0x336699
51
+ isCaching: false
52
+ ```
53
+
54
+ ## 🟢 INI
55
+
56
+ ```ini
57
+ [App]
58
+ name = Demo App
59
+ items = 25
60
+ darkMode = true
61
+
62
+ [App.Special]
63
+ color = 3368601
64
+ isCaching = false
65
+ ```
66
+
67
+ ## 🔴 TOML
68
+
69
+ ```toml
70
+ [App]
71
+ name = "Demo App"
72
+ items = 25
73
+ darkMode = true
74
+
75
+ [App.Special]
76
+ color = 0x336699
77
+ isCaching = false
78
+ ```
79
+
80
+ ## ✅ Summary
81
+
82
+ | Feature | **YINI** | **JSON** | **YAML** | **INI** | **TOML** |
83
+ |--------------------|---------------|-------------|------------|-------------|----------|
84
+ | Comments | ✅ Yes | ❌ No | ✅ Yes | ✅ Yes | ✅ Yes |
85
+ | Nesting | ✅ Clean | ✅ Manual | ✅ Native | ⚠️ Limited | ✅ Native |
86
+ | Data Types | ✅ Rich | ✅ Rich | ✅ Rich | ⚠️ Limited | ✅ Rich |
87
+ | Syntax Noise | 🚫 Minimal | 🔺 High | ⚠️ Medium | ✅ Minimal | ⚠️ Medium |
88
+ | Human-Writable | ✅ Yes | ❌ Verbose | ✅ Yes | ✅ Yes | ✅ Yes |
89
+ | Designed for Config| ✅ Purposeful | ❌ General | ✅ Yes | ✅ Yes | ✅ Yes |
@@ -0,0 +1,18 @@
1
+ // Parsed output in config from examples/nested.yini using YINI.parseFile(...)
2
+
3
+ config = {
4
+ App: {
5
+ name: 'Nested Demo App',
6
+ version: '1.2.3',
7
+ Theme: {
8
+ primaryColor: 3368601,
9
+ darkMode: true,
10
+ Overrides: { darkMode: false, fontSize: 14 },
11
+ },
12
+ },
13
+ Database: {
14
+ host: 'db.local',
15
+ port: 5432,
16
+ Credentials: { password: 'secret' },
17
+ },
18
+ }
@@ -0,0 +1,26 @@
1
+ /*
2
+ nested.yini
3
+ Demonstrates nested sections in YINI format.
4
+ */
5
+
6
+ @yini
7
+
8
+ ^ App // Top-level section: App
9
+ name = 'Nested Demo App'
10
+ version = "1.2.3"
11
+
12
+ ^^ Theme // Nested under App: App.Theme
13
+ primaryColor = #336699
14
+ darkMode = true
15
+
16
+
17
+ ^^^ Overrides // Nested under Theme: App.Theme.Overrides
18
+ darkMode = false
19
+ fontSize = 14
20
+
21
+ ^ Database // Another top-level section: Database
22
+ host = "db.local"
23
+ port = 5432
24
+
25
+ ^^ Credentials // Nested under Database: Database.Credentials username = "admin"
26
+ password = "secret"
@@ -0,0 +1,22 @@
1
+ /**
2
+ * parse-example.ts
3
+ *
4
+ * Demonstrates reading and parsing a YINI configuration file.
5
+ */
6
+
7
+ import path from 'path'
8
+ import YINI from 'yini-parser'
9
+
10
+ // Resolve path to the example config file.
11
+ const configPath = path.resolve(__dirname, './basic.yini')
12
+
13
+ // Parse the YINI config file.
14
+ const config = YINI.parseFile(configPath)
15
+
16
+ // Output some example values.
17
+ console.log('App Title:', config.App.title)
18
+ console.log('Items:', config.App.items)
19
+ console.log('Dark Theme Enabled:', config.App.isDarkTheme)
20
+
21
+ console.log('\nFull Config:')
22
+ console.dir(config, { depth: null })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yini-parser",
3
- "version": "1.0.0-alpha.7",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "Simple and flexible config parser for Node.js. YINI: an enhanced, readable alternative to JSON, INI, and YAML—built for modern JavaScript and TypeScript projects.",
5
5
  "keywords": [
6
6
  "yini",
@@ -26,7 +26,8 @@
26
26
  "package.json",
27
27
  "README.md",
28
28
  "LICENSE",
29
- "CHANGELOG.md"
29
+ "CHANGELOG.md",
30
+ "examples/"
30
31
  ],
31
32
  "main": "dist/index.js",
32
33
  "types": "dist/index.d.ts",
File without changes
File without changes