-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from hsu-aut/release
Release
- Loading branch information
Showing
22 changed files
with
636 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
!**/.eslintrc* | ||
node_modules* | ||
dist | ||
*.svg | ||
*.ico | ||
*.json | ||
.gitignore | ||
*.md | ||
*.log | ||
*.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
/* eslint-disable no-undef */ | ||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', // Specifies the ESLint parser | ||
extends: [ | ||
"eslint:recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features | ||
sourceType: 'module', // Allows for the use of imports | ||
}, | ||
rules: { | ||
"semi": ["error","always"], | ||
"indent": ["error", 4], | ||
"prefer-const": ["error",{}], | ||
"max-len": ["error", {code: 140, ignoreComments: true}] | ||
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs | ||
// e.g. "@typescript-eslint/explicit-function-return-type": "off", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"cache": false, | ||
"check-coverage": false, | ||
"extension": [ | ||
".ts" | ||
], | ||
"include": [ | ||
"**/*.js", | ||
"**/*.ts" | ||
], | ||
"exclude": [ | ||
"coverage/**", | ||
"node_modules/**", | ||
"**/*.d.ts", | ||
"**/*.test.ts", | ||
"tests/*", | ||
".eslintrc.js" | ||
], | ||
"sourceMap": true, | ||
"reporter": [ | ||
"html", | ||
"text", | ||
"text-summary" | ||
], | ||
"all": true, | ||
"instrument": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Mocha Current File", | ||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||
"args": [ | ||
"--no-timeouts", | ||
"--colors", | ||
"${file}", | ||
"--require", | ||
"ts-node/register" | ||
], | ||
"console": "integratedTerminal", | ||
"sourceMaps": true, | ||
"internalConsoleOptions": "neverOpen" | ||
}, | ||
{ | ||
"name": "Attach", | ||
"port": 9229, | ||
"request": "attach", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"type": "pwa-node" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}\\lib\\sparql-result-converter.js" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"eslint.workingDirectories": [ | ||
{ "mode": "auto" } | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
export class ArrayUtil { | ||
|
||
/** | ||
* Checks whether or not all entries of the array contain the property that is used for grouping | ||
* @param {*} arrayToCheck | ||
* @param {*} groupingProperty | ||
*/ | ||
static allEntriesContainGroupingProperty(arrayToCheck: any[], groupingProperty: string): boolean { | ||
for (let i = 0; i < arrayToCheck.length; i++) { | ||
const element = arrayToCheck[i]; | ||
if (!Object.prototype.hasOwnProperty.call(element, groupingProperty)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
|
||
|
||
/** | ||
* Transforms an array of objects to an array of simple datatypes by extracting every value-property. | ||
* @param {*} sparqlResult Array of objects that contain a value-property | ||
*/ | ||
static extractValues(sparqlResult: SparqlResultLine[]): TransformedSparqlResultElement[] { | ||
|
||
const outputArray = new Array<TransformedSparqlResultElement>(); | ||
|
||
// Take every array element and extract all values of all object keys -> flatten the array | ||
sparqlResult.forEach((sparqlResultLine:SparqlResultLine) => { | ||
const objectKeys = Object.keys(sparqlResultLine); | ||
|
||
const outputElement = {}; | ||
objectKeys.forEach((key) => { | ||
outputElement[key] = sparqlResultLine[key].value; | ||
}); | ||
outputArray.push(outputElement); | ||
}); | ||
|
||
return outputArray; | ||
} | ||
|
||
|
||
} | ||
|
||
export interface SparqlResultLine { | ||
[name: string]: { | ||
type: string, | ||
value: string | ||
} | ||
} | ||
|
||
export interface TransformedSparqlResultElement { | ||
[propName: string]: string; | ||
} | ||
|
Oops, something went wrong.