This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build with pika
- Loading branch information
Fletcher91
committed
Nov 26, 2019
1 parent
5156457
commit 13d8fb2
Showing
10 changed files
with
5,562 additions
and
62 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules/* | ||
node_modules/ | ||
pkg/ | ||
.idea | ||
.rpt2* | ||
coverage/** | ||
|
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,56 @@ | ||
{ | ||
"name": "@ontologies/core", | ||
"version": "1.5.0", | ||
"@pika/pack": { | ||
"pipeline": [ | ||
[ | ||
"@pika/plugin-ts-standard-pkg", | ||
{ | ||
"exclude": [ | ||
"__tests__/**/*" | ||
] | ||
} | ||
], | ||
[ | ||
"@pika/plugin-build-node" | ||
], | ||
[ | ||
"@pika/plugin-build-web" | ||
] | ||
] | ||
}, | ||
"description": "Like definitely typed, but for ontologies", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/module/index.js", | ||
"sideEffects": true, | ||
"types": "dist/module/index.d.ts", | ||
"scripts": { | ||
"build": "pika build", | ||
"test": "exit 0", | ||
"version": "npm run build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ontola/ontologies.git" | ||
}, | ||
"author": "Fletcher91 <[email protected]>", | ||
"license": "GPL-3.0-or-later", | ||
"bugs": { | ||
"url": "https://github.com/ontola/ontologies/issues" | ||
}, | ||
"homepage": "https://github.com/ontola/ontologies#readme", | ||
"dependencies": { | ||
"@ungap/global-this": "^0.3.1" | ||
}, | ||
"peerDependencies": { | ||
"@ontologies/core": ">=1.5.0" | ||
}, | ||
"devDependencies": { | ||
"@pika/pack": "^0.5.0", | ||
"@pika/plugin-build-node": "^0.8.1", | ||
"@pika/plugin-build-web": "^0.8.1", | ||
"@pika/plugin-ts-standard-pkg": "^0.8.1", | ||
"eslint": "^6.7.1", | ||
"typescript": "^3.7.2" | ||
} | ||
} |
File renamed without changes.
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
File renamed without changes.
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 |
---|---|---|
@@ -1,44 +1,44 @@ | ||
import { BlankNode, Literal, NamedNode, Node, Quad, SomeTerm, Term, TermType } from "./types"; | ||
|
||
export function isTerm(obj: any): obj is Term { | ||
return typeof obj === "object" && obj !== null && "termType" in obj | ||
return typeof obj === "object" && obj !== null && "termType" in obj; | ||
} | ||
|
||
export function isNamedNode(obj: any): obj is NamedNode { | ||
return isTerm(obj) && obj.termType === TermType.NamedNode | ||
return isTerm(obj) && obj.termType === TermType.NamedNode; | ||
} | ||
|
||
export function isBlankNode(obj: any): obj is BlankNode { | ||
return isTerm(obj) && obj.termType === TermType.BlankNode | ||
return isTerm(obj) && obj.termType === TermType.BlankNode; | ||
} | ||
|
||
export function isLiteral(obj: any): obj is Literal { | ||
return isTerm(obj) && obj.termType === TermType.Literal | ||
return isTerm(obj) && obj.termType === TermType.Literal; | ||
} | ||
|
||
const TermTypes = [ | ||
TermType.NamedNode.toString(), | ||
TermType.BlankNode.toString(), | ||
TermType.Literal.toString() | ||
] | ||
]; | ||
export function isSomeTerm(obj: any): obj is SomeTerm { | ||
return isTerm(obj) && TermTypes.includes(obj.termType) | ||
return isTerm(obj) && TermTypes.includes(obj.termType) === true | ||
} | ||
|
||
const NodeTypes = [TermType.NamedNode.toString(), TermType.BlankNode.toString()] | ||
const NodeTypes = [TermType.NamedNode.toString(), TermType.BlankNode.toString()]; | ||
|
||
export function isNode(obj: any): obj is Node { | ||
return isTerm(obj) && NodeTypes.includes(obj.termType) | ||
return isTerm(obj) && NodeTypes.includes(obj.termType) === true; | ||
} | ||
|
||
export function isQuad (obj: any): obj is Quad { | ||
return typeof obj === "object" && obj !== null && "subject" in obj | ||
export function isQuad(obj: any): obj is Quad { | ||
return typeof obj === "object" && obj !== null && "subject" in obj; | ||
} | ||
|
||
export function doc (node: NamedNode) { | ||
if (node.value.indexOf('#') < 0) { | ||
return node.value | ||
return node.value; | ||
} else { | ||
return node.value.split('#')[0] | ||
return node.value.split('#')[0]; | ||
} | ||
} |
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,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2019", | ||
"module": "esnext", | ||
"lib": [ | ||
"es2019" | ||
], | ||
|
||
"strict": true, | ||
|
||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
} | ||
} |
Oops, something went wrong.