Skip to content

Commit

Permalink
Merge pull request #14 from bcgsc/release/v2.0.0
Browse files Browse the repository at this point in the history
Release/v2.0.0
  • Loading branch information
creisle committed Feb 23, 2022
2 parents 01b2ae1 + 474ac04 commit ae37388
Show file tree
Hide file tree
Showing 26 changed files with 15,592 additions and 13,346 deletions.
29 changes: 20 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@
"node": true
},
"extends": [
"eslint:recommended",
"airbnb",
"plugin:jest-formatting/recommended",
"plugin:jest/recommended",
"plugin:jest-formatting/recommended"
"airbnb-base",
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"plugins": [
"jest",
"jest-formatting"
],
"rules": {
"indent": [
"@typescript-eslint/indent": [
"error",
4,
{
"SwitchCase": 1
}
4
],
"jest/consistent-test-it": [
"error",
Expand All @@ -32,7 +33,17 @@
"error",
"unix"
],
"max-len": "warn",
"max-classes-per-file": "off",
"max-len": [
"warn",
{
"code": 100,
"ignoreComments": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreTrailingComments": true
}
],
"multiline-ternary": [
"error",
"always"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/npm-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
node-version: ${{ matrix.node }}
- run: npm ci
- run: npm audit --production
- run: npm run lint
- name: test build
run: npm run build
- run: npm test
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1.6
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ node_modules/
xunit.xml
jsdoc
*tar.gz
env.sh
env.sh
dist
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,37 @@ parsed notation.
Import the package (Or try it out online with [RunKit](https://runkit.com/creisle/6083062ff39ff0001b93ea6f))

```js
const kbp = require('@bcgsc-pori/graphkb-parser');
const {parseVariant, stringifyVariant, jsonifyVariant} = require('@bcgsc-pori/graphkb-parser');
```

To use the variant parser methods simply pass a string into

```js
> const parsedResult = kbp.variant.parse('FEATURE:p.G12D');
VariantNotation(....)
> const parsedResult = parseVariant('FEATURE:p.G12D');
{
'prefix': 'p',
...
}
```

Which returns a variant notation object. This can be turned back into a string

```js
> parsedResult.toString();
> stringifyVariant(parsedResult);
'FEATURE:p.G12D'
```

or a JSON
or a JSON (removes extra attributes used by parse methods)

```js
> parsedResult.toJSON()
> jsonifyVariant(parsedResult)
```

If the notation is improperly formatted, the parse function will raise a parsing error

```js
try {
const parsedResult = kbp.variant.parse('FEATUREp.G12D');
const parsedResult = parseVariant('FEATUREp.G12D');
} catch (err) {
if (err instanceof kbp.error.ParsingError) {
console.log('Error in parsing the notation');
Expand Down
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};
9 changes: 5 additions & 4 deletions config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ module.exports = {
collectCoverage: true,
coverageDirectory: 'coverage',
collectCoverageFrom: [
'src/**.js',
'src/**/*.js',
'src/**/**/*.js',
'src/*',
'src/**/*',
'src/**/**/*',
],
coverageReporters: [
'clover',
Expand All @@ -29,13 +29,14 @@ module.exports = {
],
],
testRunner: 'jest-circus/runner',
testRegex: 'test/.*\\.js',
testRegex: 'test/.*',
testEnvironment: 'node',
testPathIgnorePatterns: [
'/node_modules/',
],
moduleFileExtensions: [
'js',
'json',
'ts',
],
};
Loading

0 comments on commit ae37388

Please sign in to comment.