bindu 2.0.0 → 2.0.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.
package/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 2026.10.15, v2.0.1
2
+
3
+ feature:
4
+ - 4b1210f sandhi: ac: apply-purvarupa
5
+
1
6
  2026.10.15, v2.0.0
2
7
 
3
8
  feature:
@@ -2,9 +2,40 @@ import {avyayamAsti} from '#avyaya';
2
2
 
3
3
  export const report = () => `ekaḥ pūrvaparayoḥ`;
4
4
 
5
- export const fix = ({path, name, nextName}) => {
6
- path.node.name = `${name}${nextName.slice(1)}`;
7
- path.parentPath.node.expressions.pop();
5
+ const DIRGHA = {
6
+ a: 'A',
7
+ A: 'A',
8
+ i: 'I',
9
+ I: 'I',
10
+ u: 'U',
11
+ U: 'U',
12
+ f: 'F',
13
+ x: 'X',
14
+ };
15
+
16
+ const YAN = {
17
+ i: 'y',
18
+ I: 'y',
19
+ u: 'v',
20
+ U: 'v',
21
+ f: 'r',
22
+ x: 'l',
23
+ };
24
+
25
+ export const fix = ({path, name, nextName, kind, yan, dirgha}) => {
26
+ if (kind === 'dirgha') {
27
+ path.node.name = `${name.slice(0, -1)}${dirgha}${nextName.slice(1)}`;
28
+ path.parentPath.node.expressions.pop();
29
+
30
+ return;
31
+ }
32
+
33
+ if (kind === 'yan') {
34
+ path.node.name = `${name.slice(0, -1)}${yan}${nextName}`;
35
+ path.parentPath.node.expressions.pop();
36
+
37
+ return;
38
+ }
8
39
  };
9
40
 
10
41
  export const traverse = ({push}) => ({
@@ -20,25 +51,47 @@ export const traverse = ({push}) => ({
20
51
  const {name} = path.node;
21
52
  const nextName = next.node.name;
22
53
 
23
- const last = name
24
- .at(-1)
25
- .toLowerCase();
54
+ if (!avyayamAsti(nextName))
55
+ return;
56
+
57
+ const last = name.at(-1);
58
+ const lastLow = last.toLowerCase();
26
59
 
27
60
  const first = nextName
28
61
  .at(0)
29
62
  .toLowerCase();
30
63
 
31
- if (!avyayamAsti(nextName))
64
+ if (!/[aiuefxAIUEOoFX]/.test(last))
65
+ return;
66
+
67
+ if (first === 'a' && lastLow === 'e')
68
+ return;
69
+
70
+ if (first === 'a' && lastLow === 'o')
32
71
  return;
33
72
 
34
- if (!/[aiueo]/.test(last) || first === 'a' && last === 'e')
73
+ if (lastLow === first && DIRGHA[last]) {
74
+ push({
75
+ path,
76
+ next,
77
+ name,
78
+ nextName,
79
+ kind: 'dirgha',
80
+ dirgha: DIRGHA[last],
81
+ });
35
82
  return;
83
+ }
36
84
 
37
- push({
38
- path,
39
- next,
40
- name,
41
- nextName,
42
- });
85
+ if (YAN[last] && /[aiueoAIUEOfx]/.test(first)) {
86
+ push({
87
+ path,
88
+ next,
89
+ name,
90
+ nextName,
91
+ kind: 'yan',
92
+ yan: YAN[last],
93
+ });
94
+ return;
95
+ }
43
96
  },
44
97
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bindu",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Pāṇini Aṣṭādhyāyī",
5
5
  "main": "lib/bindu.js",
6
6
  "bin": {