bindu 1.7.0 → 1.8.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/ChangeLog CHANGED
@@ -1,3 +1,13 @@
1
+ 2025.12.15, v1.8.0
2
+
3
+ feature:
4
+ - 4daad4d bindu: apply-padantad: add
5
+
6
+ 2025.12.14, v1.7.1
7
+
8
+ feature:
9
+ - 91dcacd bindu: sandhi: vriddhi: improve support
10
+
1
11
  2025.12.14, v1.7.0
2
12
 
3
13
  fix:
package/README.md CHANGED
@@ -28,12 +28,11 @@ import {bindu} from 'bindu';
28
28
 
29
29
  bindu('प्रतिएक');
30
30
  // returns {code: 'प्रत्येक'}
31
-
32
31
  bindu('द्रौपदी अश्वम्', {
33
32
  type: 'iast',
34
33
  });
35
- // returns {code: 'draupadyaśvam'}
36
34
 
35
+ // returns {code: 'draupadyaśvam'}
37
36
  const {places} = bindu('प्रतिएक', {
38
37
  fix: false,
39
38
  });
@@ -52,6 +51,23 @@ places[0].message;
52
51
  - ✅[`sandhi/apply-vriddhi`](https://putout.cloudcmd.io/#/gist/7cdc2383c74d7afeb8cfd93df7b5f868/79b1c979be725fc082cf81991b16fac527cfcd7b): [वृद्धिरेचि](https://www.learnsanskrit.org/panini/vowel/#:~:text=and%20%C4%81.-,6.1.88,-%E0%A4%B5%E0%A5%83%E0%A4%A6%E0%A5%8D%E0%A4%A7%E0%A4%BF%E0%A4%B0%E0%A5%87%E0%A4%9A%E0%A4%BF);
53
52
  - ✅[`sandhi/apply-purvarupa`](https://putout.cloudcmd.io/#/gist/23e2b612a185529ea6823e5f81d35b7d/2ace30ac469be03af1c41911b78d85e85b9a1120): [एकः पूर्वपरयोः](https://www.learnsanskrit.org/panini/vowel/#:~:text=this%20rule%20mean%3F-,%E0%A4%8F%E0%A4%95%E0%A4%83%20%E0%A4%AA%E0%A5%82%E0%A4%B0%E0%A5%8D%E0%A4%B5%E0%A4%AA%E0%A4%B0%E0%A4%AF%E0%A5%8B%E0%A4%83,-eka%E1%B8%A5%20p%C5%ABrvaparayo%E1%B8%A5)
54
53
  - ✅[`sandhi/apply-ayadaya`](https://putout.cloudcmd.io/#/gist/39db56c40174f61caed795c2a2dc89a7/dc956c6b0834167d9814ba70036674f4a10f56f9): [आयादयः](https://www.learnsanskrit.org/references/sandhi/vowel/#:~:text=madhu%20iva%20%E2%86%92%20madhviva-,Now,-%2C%20some%20examples%20for)
54
+ - ✅[`sandhi/apply-padantad`](https://putout.cloudcmd.io/#/gist/f73f49bf102a6f2ab34a100ee29f81cc/6b1c3f1595841a08a035437924165e4b8d27896d): [एङः पदान्तादति](https://www.gingersunrise.com/i/133147357/एङ-पदनतदत);
55
+
56
+ #### apply-padantad
57
+
58
+ ```
59
+ ए + अ → एऽ
60
+ e + a → e'
61
+
62
+ ओ + अ → ओऽ
63
+ o + a → o'
64
+
65
+ ऐ + अ → ऐऽ
66
+ ai + a → ai'
67
+
68
+ औ + अ → औऽ
69
+ au + a → au'
70
+ ```
55
71
 
56
72
  #### apply-ayadaya
57
73
 
@@ -0,0 +1,38 @@
1
+ import {operator} from 'putout';
2
+ import {avagraha} from '../../symbols.js';
3
+
4
+ const {remove} = operator;
5
+
6
+ export const report = () => `eṅaḥ padāntād ati`;
7
+
8
+ export const fix = ({path, next, name, nextName}) => {
9
+ path.node.name = `${name}${avagraha.code}${nextName.slice(1)}`;
10
+ remove(next);
11
+ };
12
+
13
+ export const traverse = ({push}) => ({
14
+ Identifier(path) {
15
+ const next = path.getNextSibling();
16
+
17
+ if (!next.node)
18
+ return;
19
+
20
+ const {name} = path.node;
21
+ const nextName = next.node.name;
22
+
23
+ const first = nextName.at(0);
24
+
25
+ if (first !== 'a')
26
+ return;
27
+
28
+ if (!/(a[ui]|[eo])$/.test(name))
29
+ return;
30
+
31
+ push({
32
+ path,
33
+ next,
34
+ name,
35
+ nextName,
36
+ });
37
+ },
38
+ });
@@ -5,7 +5,9 @@ const {remove} = operator;
5
5
  export const report = () => `vṛddhireci`;
6
6
 
7
7
  export const fix = ({path, next, name, nextName}) => {
8
- path.node.name = `${name.slice(0, -1)}A${nextName.slice(1)}`;
8
+ const joint = getJoint(nextName);
9
+
10
+ path.node.name = `${name}${joint}${nextName.slice(1)}`;
9
11
  remove(next);
10
12
  };
11
13
 
@@ -23,9 +25,12 @@ export const traverse = ({push}) => ({
23
25
  .at(-1)
24
26
  .toLowerCase();
25
27
 
26
- const [first, second] = nextName;
28
+ const [first] = nextName;
27
29
 
28
- if (last !== 'a' || first !== 'a' || !/[iu]/.test(second))
30
+ if (last !== 'a')
31
+ return;
32
+
33
+ if (!/[oe]/.test(first) && !/^a[iu]/.test(nextName))
29
34
  return;
30
35
 
31
36
  push({
@@ -36,3 +41,16 @@ export const traverse = ({push}) => ({
36
41
  });
37
42
  },
38
43
  });
44
+
45
+ function getJoint([first, second]) {
46
+ if (first === 'e')
47
+ return 'i';
48
+
49
+ if (second === 'i')
50
+ return '';
51
+
52
+ if (second === 'u')
53
+ return '';
54
+
55
+ return 'u';
56
+ }
@@ -1,3 +1,4 @@
1
+ import * as applyPadantad from './apply-padantad/index.js';
1
2
  import * as applyAyadaya from './apply-ayadaya/index.js';
2
3
  import * as applyPurvarupa from './apply-purvarupa/index.js';
3
4
  import * as applyVriddhi from './apply-vriddhi/index.js';
@@ -12,4 +13,5 @@ export const rules = {
12
13
  'apply-vriddhi': applyVriddhi,
13
14
  'apply-purvarupa': applyPurvarupa,
14
15
  'apply-ayadaya': applyAyadaya,
16
+ 'apply-padantad': applyPadantad,
15
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bindu",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Pāṇini Aṣṭādhyāyī",
5
5
  "main": "lib/bindu.js",
6
6
  "bin": {