@vm75/inditrans 0.4.0 → 0.4.2

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.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.4.2
2
+
3
+ - Added case insensitive support for iast, iso and ipa. Added support for extended latin chars with composition
4
+
5
+ ## 0.4.1
6
+
7
+ - Split symbols, Zero Width chars and Vedic symbols
8
+
1
9
  ## 0.4.0
2
10
 
3
11
  - Lot of refactoring.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # inditrans
2
2
 
3
- An experimental transliterator library for some [Indic/Indic](https://en.wikipedia.org/wiki/Brahmic_scripts) scripts.
3
+ An experimental transliterator library for some [Indic/Brahmic](https://en.wikipedia.org/wiki/Brahmic_scripts) scripts.
4
4
 
5
5
  - Self-contained and performant. Uses wasm.
6
6
  - Supports [vedic accents](https://en.wikipedia.org/wiki/Vedic_accent). Useful for vedic scriptures.
@@ -9,4 +9,5 @@ export declare class Inditrans {
9
9
  private utf82ToString;
10
10
  private stringToUtf8;
11
11
  transliterate(text: string, from: Script, to: Script, options: Option): string;
12
+ isScriptSupported(script: string): boolean;
12
13
  }
@@ -54,6 +54,12 @@ class Inditrans {
54
54
  pointers.map((ptr) => this.module.stackRestore(ptr));
55
55
  return result;
56
56
  }
57
+ isScriptSupported(script) {
58
+ const ptr = this.stringToUtf8(script);
59
+ const result = this.module.isScriptSupported(ptr);
60
+ this.module.stackRestore(ptr);
61
+ return result == 1;
62
+ }
57
63
  }
58
64
  exports.Inditrans = Inditrans;
59
65
  //# sourceMappingURL=Inditrans.js.map
@@ -1,5 +1,6 @@
1
1
  export interface InditransModule {
2
2
  transliterate(text: number, from: number, to: number, options: number): number;
3
+ isScriptSupported(script: number): number;
3
4
  releaseBuffer(ptr: number): void;
4
5
  stackAlloc(size: number): number;
5
6
  stackRestore(ptr: number): void;
@@ -1,9 +1,8 @@
1
1
  export declare enum Option {
2
2
  None = 0,
3
- IgnoreVedicAccents = 1,
4
- IgnoreQuotedMarkers = 2,
5
- TamilTraditional = 4,
6
- TamilSuperscripted = 8,
7
- RetainZeroWidthChars = 16,
8
- ASCIINumerals = 32
3
+ TamilTraditional = 1,
4
+ TamilSuperscripted = 2,
5
+ ASCIINumerals = 4,
6
+ IgnoreVedicAccents = 8,
7
+ ShowQuotedMarkers = 16
9
8
  }
@@ -4,11 +4,10 @@ exports.Option = void 0;
4
4
  var Option;
5
5
  (function (Option) {
6
6
  Option[Option["None"] = 0] = "None";
7
- Option[Option["IgnoreVedicAccents"] = 1] = "IgnoreVedicAccents";
8
- Option[Option["IgnoreQuotedMarkers"] = 2] = "IgnoreQuotedMarkers";
9
- Option[Option["TamilTraditional"] = 4] = "TamilTraditional";
10
- Option[Option["TamilSuperscripted"] = 8] = "TamilSuperscripted";
11
- Option[Option["RetainZeroWidthChars"] = 16] = "RetainZeroWidthChars";
12
- Option[Option["ASCIINumerals"] = 32] = "ASCIINumerals";
7
+ Option[Option["TamilTraditional"] = 1] = "TamilTraditional";
8
+ Option[Option["TamilSuperscripted"] = 2] = "TamilSuperscripted";
9
+ Option[Option["ASCIINumerals"] = 4] = "ASCIINumerals";
10
+ Option[Option["IgnoreVedicAccents"] = 8] = "IgnoreVedicAccents";
11
+ Option[Option["ShowQuotedMarkers"] = 16] = "ShowQuotedMarkers";
13
12
  })(Option = exports.Option || (exports.Option = {}));
14
13
  //# sourceMappingURL=Option.js.map
@@ -3,5 +3,6 @@ import { Script } from './Script';
3
3
  export { Option, Script };
4
4
  export declare function init(): Promise<void>;
5
5
  export declare function transliterate(text: string, from: Script, to: Script, options: Option): string;
6
- declare const _default: (typeof Option | typeof Script | typeof init | typeof transliterate)[];
6
+ export declare function isScriptSupported(script: string): boolean;
7
+ declare const _default: (typeof Option | typeof Script | typeof init | typeof transliterate | typeof isScriptSupported)[];
7
8
  export default _default;
package/dist/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transliterate = exports.init = exports.Script = exports.Option = void 0;
3
+ exports.isScriptSupported = exports.transliterate = exports.init = exports.Script = exports.Option = void 0;
4
4
  const Inditrans_1 = require("./Inditrans");
5
5
  const Option_1 = require("./Option");
6
6
  Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return Option_1.Option; } });
@@ -18,5 +18,12 @@ function transliterate(text, from, to, options) {
18
18
  return inditrans.transliterate(text, from, to, options);
19
19
  }
20
20
  exports.transliterate = transliterate;
21
- exports.default = [Option_1.Option, Script_1.Script, init, transliterate];
21
+ function isScriptSupported(script) {
22
+ if (!inditrans) {
23
+ throw new Error('Inditrans not initialized');
24
+ }
25
+ return inditrans.isScriptSupported(script);
26
+ }
27
+ exports.isScriptSupported = isScriptSupported;
28
+ exports.default = [Option_1.Option, Script_1.Script, init, transliterate, isScriptSupported];
22
29
  //# sourceMappingURL=index.js.map
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm75/inditrans",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "An experimental transliterator library for some Indic/Brahmic scripts.",
5
5
  "main": "./dist/src/index.js",
6
6
  "author": "VM75",