bindu 1.5.0 → 1.6.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,8 @@
1
+ 2025.12.12, v1.6.0
2
+
3
+ feature:
4
+ - d4f2d69 bindu: avyaya: add
5
+
1
6
  2025.12.11, v1.5.0
2
7
 
3
8
  feature:
@@ -0,0 +1,7 @@
1
+ export const demonstratives = {
2
+ ayam: 'this (masculine singular)',
3
+ iyam: 'this (feminine singular)',
4
+ ayaM: 'this (dual)',
5
+ eso: 'this (masculine singular, near)',
6
+ esaU: 'this (feminine singular, near)',
7
+ };
@@ -0,0 +1,15 @@
1
+ import {particles} from './particles.js';
2
+ import {pronouns} from './pronouns.js';
3
+ import {demonstratives} from './demonstratives.js';
4
+
5
+ const {keys} = Object;
6
+
7
+ const avyaya = new Set([
8
+ ...keys(particles),
9
+ ...keys(pronouns),
10
+ ...keys(demonstratives),
11
+ ]);
12
+
13
+ export const avyayamAsti = (a) => {
14
+ return avyaya.has(a);
15
+ };
@@ -0,0 +1,22 @@
1
+ export const particles = {
2
+ iti: 'thus, so',
3
+ iha: 'here',
4
+ api: 'also, even',
5
+ ca: 'and',
6
+ eva: 'indeed, certainly',
7
+ hi: 'surely, indeed',
8
+ vā: 'or',
9
+ tu: 'but',
10
+ na: 'not',
11
+ vA: 'or (alternative form of vā)',
12
+ tathA: 'thus, in that way',
13
+ kintu: 'but, however',
14
+ atha: 'then, now',
15
+ athaApi: 'and also then',
16
+ athaiva: 'then only, just then',
17
+ atara: 'however, but',
18
+ evaM: 'thus, in this way',
19
+ tvam: 'you (used as particle sometimes)',
20
+ yad: 'if',
21
+ yatra: 'where',
22
+ };
@@ -0,0 +1,22 @@
1
+ export const pronouns = {
2
+ aham: 'I',
3
+ tvam: 'you (singular)',
4
+ asmad: 'we (exclusive)',
5
+ yuSmad: 'you (plural)',
6
+ saH: 'he',
7
+ sA: 'she',
8
+ so: 'he (alternate form)',
9
+ saU: 'she (alternate form)',
10
+ yad: 'who, which',
11
+ yam: 'whom',
12
+ yUyam: 'you (plural)',
13
+ asmAkaM: 'our',
14
+ yuSmAkaM: 'your (plural)',
15
+ te: 'they (dual/plural)',
16
+ teSu: 'them (plural)',
17
+ tasya: 'his',
18
+ tasmin: 'in him',
19
+ tasyaH: 'of him',
20
+ asmai: 'to me',
21
+ tve: 'to you',
22
+ };
@@ -1,15 +1,12 @@
1
1
  import {operator} from 'putout';
2
+ import {avagraha} from '../../symbols.js';
2
3
 
3
4
  const {remove} = operator;
4
- const SANDHI = {
5
- e: 'aya',
6
- o: 'ava',
7
- };
8
5
 
9
6
  export const report = () => `ayādayaḥ`;
10
7
 
11
8
  export const fix = ({path, next, name, nextName}) => {
12
- const joint = SANDHI[nextName];
9
+ const joint = createJoint(name, nextName);
13
10
 
14
11
  path.node.name = `${name.slice(0, -1)}${joint}${nextName.slice(1)}`;
15
12
  remove(next);
@@ -33,7 +30,7 @@ export const traverse = ({push}) => ({
33
30
  .at(0)
34
31
  .toLowerCase();
35
32
 
36
- if (last !== 'a' || !/[eo]/.test(first))
33
+ if (!/[aiueo]/.test(last) || !/[aiueo]/.test(first))
37
34
  return;
38
35
 
39
36
  push({
@@ -44,3 +41,16 @@ export const traverse = ({push}) => ({
44
41
  });
45
42
  },
46
43
  });
44
+
45
+ function createJoint(name, nextName) {
46
+ if (name.endsWith('a') && nextName.startsWith('e'))
47
+ return 'aye';
48
+
49
+ if (name.endsWith('a') && nextName.startsWith('o'))
50
+ return 'ayau';
51
+
52
+ if (name.endsWith('e') && nextName.startsWith('a'))
53
+ return `e${avagraha.code}`;
54
+
55
+ return '';
56
+ }
@@ -1,4 +1,5 @@
1
1
  import {operator} from 'putout';
2
+ import {avyayamAsti} from '#avyaya';
2
3
 
3
4
  const {remove} = operator;
4
5
 
@@ -19,6 +20,9 @@ export const traverse = ({push}) => ({
19
20
  const {name} = path.node;
20
21
  const nextName = next.node.name;
21
22
 
23
+ if (avyayamAsti(nextName))
24
+ return;
25
+
22
26
  const last = name
23
27
  .at(-1)
24
28
  .toLowerCase();
@@ -1,12 +1,12 @@
1
1
  import {operator} from 'putout';
2
- import {avagraha} from '../../symbols.js';
2
+ import {avyayamAsti} from '#avyaya';
3
3
 
4
4
  const {remove} = operator;
5
5
 
6
6
  export const report = () => `ekaḥ pūrvaparayoḥ`;
7
7
 
8
8
  export const fix = ({path, next, name, nextName}) => {
9
- path.node.name = `${name}${avagraha.code}${nextName.slice(1)}`;
9
+ path.node.name = `${name}${nextName.slice(1)}`;
10
10
  remove(next);
11
11
  };
12
12
 
@@ -28,7 +28,10 @@ export const traverse = ({push}) => ({
28
28
  .at(0)
29
29
  .toLowerCase();
30
30
 
31
- if (first !== 'a' || !/[eo]/.test(last))
31
+ if (!avyayamAsti(nextName))
32
+ return;
33
+
34
+ if (!/[aiueo]/.test(last) || first === 'a' && last === 'e')
32
35
  return;
33
36
 
34
37
  push({
@@ -1,15 +1,11 @@
1
1
  import {operator} from 'putout';
2
2
 
3
3
  const {remove} = operator;
4
- const SANDHI = {
5
- e: 'ai',
6
- o: 'au',
7
- };
8
4
 
9
5
  export const report = () => `vṛddhireci`;
10
6
 
11
- export const fix = ({path, next, name, nextName, vriddhi}) => {
12
- path.node.name = `${name.slice(0, -1)}${vriddhi}${nextName.slice(1)}`;
7
+ export const fix = ({path, next, name, nextName}) => {
8
+ path.node.name = `${name.slice(0, -1)}A${nextName.slice(1)}`;
13
9
  remove(next);
14
10
  };
15
11
 
@@ -27,19 +23,14 @@ export const traverse = ({push}) => ({
27
23
  .at(-1)
28
24
  .toLowerCase();
29
25
 
30
- const first = nextName
31
- .at(0)
32
- .toLowerCase();
26
+ const [first, second] = nextName;
33
27
 
34
- if (last !== 'a' || !/[eo]/.test(first))
28
+ if (last !== 'a' || first !== 'a' || !/[iu]/.test(second))
35
29
  return;
36
30
 
37
- const vriddhi = SANDHI[first];
38
-
39
31
  push({
40
32
  path,
41
33
  next,
42
- vriddhi,
43
34
  name,
44
35
  nextName,
45
36
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bindu",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Pāṇini Aṣṭādhyāyī",
5
5
  "main": "lib/bindu.js",
6
6
  "bin": {
@@ -41,6 +41,11 @@
41
41
  "engines": {
42
42
  "node": ">=20"
43
43
  },
44
+ "imports": {
45
+ "#avyaya": {
46
+ "default": "./lib/avyaya/index.js"
47
+ }
48
+ },
44
49
  "dependencies": {
45
50
  "@indic-transliteration/sanscript": "^1.3.3",
46
51
  "putout": "^41.0.0"