@teselagen/bio-parsers 0.1.19 → 0.1.21

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/index.js CHANGED
@@ -31051,7 +31051,7 @@ function parseGeneiousJson(geneiousJson) {
31051
31051
  searchWholeObjByNameSimpleArray("annotation", geneiousJsonInner),
31052
31052
  function(feature) {
31053
31053
  if (feature) {
31054
- const name2 = searchWholeObjByNameSimple("description", feature);
31054
+ const name2 = (searchWholeObjByNameSimple("description", feature) || "").substring(0, 255);
31055
31055
  const intervals = searchWholeObjByNameSimpleArray("interval", feature);
31056
31056
  const type = searchWholeObjByNameSimple("type", feature);
31057
31057
  const firstInterval = intervals[0];
@@ -31662,9 +31662,17 @@ function anyToJson(fileContentStringOrFileObj, options) {
31662
31662
  return snapgeneToJson(fileContentStringOrFileObj, options);
31663
31663
  } else if (/^(geneious)$/.test(ext)) {
31664
31664
  const a = yield getUint8ArrayFromFile(fileContentStringOrFileObj);
31665
- const b = unzipSync(a);
31666
- const c = Object.values(b)[0];
31667
- const d = new TextDecoder().decode(c, { stream: false });
31665
+ let d;
31666
+ try {
31667
+ d = new TextDecoder().decode(a, { stream: false });
31668
+ if (!d.includes("<geneious")) {
31669
+ throw new Error("not geneious");
31670
+ }
31671
+ } catch (e) {
31672
+ const b = unzipSync(a);
31673
+ const c = Object.values(b)[0];
31674
+ d = new TextDecoder().decode(c, { stream: false });
31675
+ }
31668
31676
  return geneiousXmlToJson(d, options);
31669
31677
  } else {
31670
31678
  fileContentString = yield getUtf8StringFromFile(
package/index.mjs CHANGED
@@ -31049,7 +31049,7 @@ function parseGeneiousJson(geneiousJson) {
31049
31049
  searchWholeObjByNameSimpleArray("annotation", geneiousJsonInner),
31050
31050
  function(feature) {
31051
31051
  if (feature) {
31052
- const name2 = searchWholeObjByNameSimple("description", feature);
31052
+ const name2 = (searchWholeObjByNameSimple("description", feature) || "").substring(0, 255);
31053
31053
  const intervals = searchWholeObjByNameSimpleArray("interval", feature);
31054
31054
  const type = searchWholeObjByNameSimple("type", feature);
31055
31055
  const firstInterval = intervals[0];
@@ -31660,9 +31660,17 @@ function anyToJson(fileContentStringOrFileObj, options) {
31660
31660
  return snapgeneToJson(fileContentStringOrFileObj, options);
31661
31661
  } else if (/^(geneious)$/.test(ext)) {
31662
31662
  const a = yield getUint8ArrayFromFile(fileContentStringOrFileObj);
31663
- const b = unzipSync(a);
31664
- const c = Object.values(b)[0];
31665
- const d = new TextDecoder().decode(c, { stream: false });
31663
+ let d;
31664
+ try {
31665
+ d = new TextDecoder().decode(a, { stream: false });
31666
+ if (!d.includes("<geneious")) {
31667
+ throw new Error("not geneious");
31668
+ }
31669
+ } catch (e) {
31670
+ const b = unzipSync(a);
31671
+ const c = Object.values(b)[0];
31672
+ d = new TextDecoder().decode(c, { stream: false });
31673
+ }
31666
31674
  return geneiousXmlToJson(d, options);
31667
31675
  } else {
31668
31676
  fileContentString = yield getUtf8StringFromFile(
package/index.umd.js CHANGED
@@ -31053,7 +31053,7 @@ ${seq.sequence}
31053
31053
  searchWholeObjByNameSimpleArray("annotation", geneiousJsonInner),
31054
31054
  function(feature) {
31055
31055
  if (feature) {
31056
- const name3 = searchWholeObjByNameSimple("description", feature);
31056
+ const name3 = (searchWholeObjByNameSimple("description", feature) || "").substring(0, 255);
31057
31057
  const intervals = searchWholeObjByNameSimpleArray("interval", feature);
31058
31058
  const type = searchWholeObjByNameSimple("type", feature);
31059
31059
  const firstInterval = intervals[0];
@@ -31664,9 +31664,17 @@ ${seq.sequence}
31664
31664
  return snapgeneToJson(fileContentStringOrFileObj, options);
31665
31665
  } else if (/^(geneious)$/.test(ext)) {
31666
31666
  const a = yield getUint8ArrayFromFile(fileContentStringOrFileObj);
31667
- const b = unzipSync(a);
31668
- const c = Object.values(b)[0];
31669
- const d = new TextDecoder().decode(c, { stream: false });
31667
+ let d;
31668
+ try {
31669
+ d = new TextDecoder().decode(a, { stream: false });
31670
+ if (!d.includes("<geneious")) {
31671
+ throw new Error("not geneious");
31672
+ }
31673
+ } catch (e) {
31674
+ const b = unzipSync(a);
31675
+ const c = Object.values(b)[0];
31676
+ d = new TextDecoder().decode(c, { stream: false });
31677
+ }
31670
31678
  return geneiousXmlToJson(d, options);
31671
31679
  } else {
31672
31680
  fileContentString = yield getUtf8StringFromFile(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/bio-parsers",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "type": "commonjs",
5
5
  "dependencies": {
6
6
  "@gmod/gff": "^1.2.1",