tycho-components 0.2.0-SNAPSHOT-7 → 0.2.0-SNAPSHOT-9

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.
@@ -1,7 +1,8 @@
1
1
  import { Struct, Token } from '../configs/types/Struct';
2
2
  declare const SentenceUtils: {
3
3
  sort: (struct: Struct) => Token[];
4
- getAsText: (struct: Struct) => string;
4
+ getAsText: (struct: Struct, displayTags?: boolean) => string;
5
5
  isVisible: (token: Token) => boolean;
6
+ isFirstFromSplit: (token: Token) => boolean;
6
7
  };
7
8
  export default SentenceUtils;
@@ -1,13 +1,18 @@
1
- const getAsText = (struct) => {
1
+ const getAsText = (struct, displayTags) => {
2
2
  const tokens = sort(struct);
3
3
  let value = '';
4
4
  tokens.forEach((token, idx) => {
5
5
  if (!isVisible(token))
6
6
  return;
7
- value += `${token.split ? token.split.v : token.v} `;
7
+ value += `${getValue(token, displayTags)} `;
8
8
  });
9
9
  return value.trim();
10
10
  };
11
+ const getValue = (token, displayTags) => {
12
+ return token.split !== undefined && token.ec === undefined && !displayTags
13
+ ? token.split.v
14
+ : token.v;
15
+ };
11
16
  const sort = (struct) => {
12
17
  if (!struct?.tokens)
13
18
  return [];
@@ -29,5 +34,6 @@ const SentenceUtils = {
29
34
  sort,
30
35
  getAsText,
31
36
  isVisible,
37
+ isFirstFromSplit,
32
38
  };
33
39
  export default SentenceUtils;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.2.0-SNAPSHOT-7",
4
+ "version": "0.2.0-SNAPSHOT-9",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {