nodejs-nomer 1.2.0 → 1.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodejs-nomer",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "NodeJS wrapper for nomer",
5
5
  "bin": {
6
6
  "nomer": "./bin/nomer"
@@ -26,11 +26,14 @@
26
26
  },
27
27
  "homepage": "https://github.com/zedomel/nodejs-nomer#readme",
28
28
  "devDependencies": {
29
- "@babel/cli": "^7.23.9",
30
- "@babel/core": "^7.24.0",
31
- "@babel/preset-env": "^7.24.0"
29
+ "@babel/cli": "^7.24.8",
30
+ "@babel/core": "^7.24.9",
31
+ "@babel/preset-env": "^7.24.8",
32
+ "babel-loader": "^9.1.3",
33
+ "webpack": "^5.93.0",
34
+ "webpack-cli": "^5.1.4"
32
35
  },
33
36
  "dependencies": {
34
37
  "properties-file": "^3.5.1"
35
38
  }
36
- }
39
+ }
package/src/index.js CHANGED
@@ -3,7 +3,7 @@ import Result from './result'
3
3
  import { getProperties } from "properties-file";
4
4
 
5
5
 
6
- class Nomer {
6
+ export class Nomer {
7
7
 
8
8
  propertiesPath = null;
9
9
  echoOpt = "";
@@ -104,8 +104,4 @@ class Nomer {
104
104
  const schemaAppend = JSON.parse(properties["nomer.append.schema.output"]).map((i) => i.type)
105
105
  return Result.tsv(result, [...schemaInput, "matchType", ...schemaAppend])
106
106
  }
107
-
108
-
109
- }
110
-
111
- module.exports = Nomer;
107
+ }
package/src/result.js CHANGED
@@ -1,4 +1,4 @@
1
- class Result {
1
+ export class Result {
2
2
 
3
3
  static json(result) {
4
4
  const arr = [];
@@ -14,6 +14,4 @@ class Result {
14
14
 
15
15
  return columns ? arr.map((v) => Object.assign(...columns.map((k, i) => ({ [k]: v[i] })))) : arr
16
16
  }
17
- }
18
-
19
- module.exports = Result
17
+ }
package/src/utils.js CHANGED
@@ -1,6 +1,6 @@
1
- const { execSync, exec, spawn } = require('child_process')
1
+ const { execSync, spawn } = require('child_process')
2
2
 
3
- const getNomerValidateCmd = (filepath = "", cmd = "validate-term", properties = null) => {
3
+ export const getNomerValidateCmd = (filepath = "", cmd = "validate-term", properties = null) => {
4
4
  if (filepath === "") {
5
5
  throw new Exception("Filepath cannot be empty string");
6
6
  }
@@ -12,7 +12,7 @@ const getNomerValidateCmd = (filepath = "", cmd = "validate-term", properties =
12
12
  return nomerCmd;
13
13
  }
14
14
 
15
- const getNomerMatchCmd = (query = "", cmd = "append", matcher = "globi-taxon-cache", properties = null, outputFormat = null, echoOpt = "-e") => {
15
+ export const getNomerMatchCmd = (query = "", cmd = "append", matcher = "globi-taxon-cache", properties = null, outputFormat = null, echoOpt = "-e") => {
16
16
  let nomerCmd = `echo ${echoOpt} '${query}' | nomer ${cmd} ${matcher}`;
17
17
  if (properties) {
18
18
  nomerCmd = `${nomerCmd} -p ${properties}`;
@@ -24,7 +24,7 @@ const getNomerMatchCmd = (query = "", cmd = "append", matcher = "globi-taxon-cac
24
24
  return nomerCmd;
25
25
  }
26
26
 
27
- const getNomerSimpleCmd = (cmd = "version", verbose = false, properties = null, outputFormat = null) => {
27
+ export const getNomerSimpleCmd = (cmd = "version", verbose = false, properties = null, outputFormat = null) => {
28
28
  let nomerCmd = `nomer ${cmd}`;
29
29
  if (properties) {
30
30
  nomerCmd = `${nomerCmd} -p ${properties}`;
@@ -39,7 +39,7 @@ const getNomerSimpleCmd = (cmd = "version", verbose = false, properties = null,
39
39
  return nomerCmd;
40
40
  }
41
41
 
42
- const runNomer = (nomerCmd) => {
42
+ export const runNomer = (nomerCmd) => {
43
43
  try {
44
44
  const result = execSync(nomerCmd, {
45
45
  maxBuffer: 4096 * 4096,
@@ -53,7 +53,7 @@ const runNomer = (nomerCmd) => {
53
53
  }
54
54
  }
55
55
 
56
- const runNomerAsync = (nomerCmd) => {
56
+ export const runNomerAsync = (nomerCmd) => {
57
57
  const nomerCmdArr = nomerCmd.split(/\s+/)
58
58
  const p = spawn(nomerCmdArr[0], nomerCmdArr.slice(1), {
59
59
  // maxBuffer: 4096 * 4096
@@ -61,12 +61,4 @@ const runNomerAsync = (nomerCmd) => {
61
61
  })
62
62
 
63
63
  return p
64
- }
65
-
66
- module.exports = {
67
- getNomerValidateCmd,
68
- getNomerMatchCmd,
69
- getNomerSimpleCmd,
70
- runNomer,
71
- runNomerAsync
72
- };
64
+ }
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./dist');;