Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Make URI constants consistent #152

Merged
merged 1 commit into from Sep 16, 2020
Merged

refactor: Make URI constants consistent #152

merged 1 commit into from Sep 16, 2020

Conversation

joachimvh
Copy link
Member

This stores all our URI constants in 1 file now. They are stored as strings and not as named nodes so they can be used in the objectmap of the RepresentationMetadata constructor. This PR does also add some helper functions to cache the named nodes we generate from them to prevent having to do that all the time.

@joachimvh joachimvh added the ☀️ enhancement New feature or request label Sep 11, 2020
@@ -0,0 +1,65 @@
const createSuffixFn = (prefix: string): any => (suffix: string): string => `${prefix}${suffix}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const createSuffixFn = (prefix: string): any => (suffix: string): string => `${prefix}${suffix}`;
const createNamespace = (prefix: string): any => (suffix: string): string => `${prefix}${suffix}`;

src/util/UriUtil.ts Show resolved Hide resolved
* so only use this for internal constants!
* @param name - Predicate to potentially transform.
*/
export const getNamedNode = (name: NamedNode | string): NamedNode => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const getNamedNode = (name: NamedNode | string): NamedNode => {
export const toNamedNode = (name: NamedNode | string): NamedNode => {

* Converts an object to a literal when needed.
* @param object - Object to potentially transform.
*/
export const getObjectTerm = (object: NamedNode | Literal | string): NamedNode | Literal =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const getObjectTerm = (object: NamedNode | Literal | string): NamedNode | Literal =>
export const toObjectTerm = (object: NamedNode | Literal | string): NamedNode | Literal =>

* @param object - Object value.
* @param dataType - Object data type (as string).
*/
export const getTypedLiteral = (object: string | number, dataType: string): Literal =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export const getTypedLiteral = (object: string | number, dataType: string): Literal =>
export const toTypedLiteral = (object: string | number, dataType: string): Literal =>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☀️ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants