jskos-tools
Advanced tools
Comparing version 1.0.32 to 1.0.33
/*! | ||
* jskos-tools v1.0.32 | ||
* jskos-tools v1.0.33 | ||
* Copyright (c) 2018 Verbundzentrale des GBV (VZG) | ||
@@ -1849,2 +1849,13 @@ * @license MIT | ||
} | ||
function guessSchemeFromNotation(notation, schemes) { | ||
return schemes.filter(_ref => { | ||
let { | ||
notationPattern | ||
} = _ref; | ||
if ((notationPattern || ".+") === ".+") { | ||
return false; | ||
} | ||
return RegExp("^" + notationPattern + "$").test(notation); | ||
}); | ||
} | ||
var tools$1 = { | ||
@@ -1892,3 +1903,4 @@ addContext, | ||
annotationCreatorName, | ||
annotationCreatorMatches | ||
annotationCreatorMatches, | ||
guessSchemeFromNotation | ||
}; | ||
@@ -1895,0 +1907,0 @@ |
@@ -884,5 +884,13 @@ const _ = require("./utils") | ||
function guessSchemeFromNotation(notation, schemes) { | ||
return schemes.filter(({notationPattern}) => { | ||
if ((notationPattern||".+") === ".+") { | ||
return false | ||
} | ||
return RegExp("^" + notationPattern + "$").test(notation) | ||
}) | ||
} | ||
module.exports = { | ||
addContext, clean, cleanJSKOS, copyDeep, deepCopy, getAllUris, compare,compareObjects, compareSchemes, compareConcepts, isConcept, isScheme, isContainedIn, isSchemeInList, sortConcepts, sortSchemes, minifyMapping, mappingTypes, mappingTypeByUri, mappingTypeByType, flattenMapping, mappingCSV, defaultMappingType, conceptsOfMapping, compareMappingsDeep, objectTypes, guessObjectType, matchObjectTypes, mergeUris, merge, normalize, isValidUri, compareFunctions, userOwnsMapping, notation, languageMapContent, prefLabel, definition, mappingRegistryIsStored, annotationCreatorUri, annotationCreatorName, annotationCreatorMatches, | ||
addContext, clean, cleanJSKOS, copyDeep, deepCopy, getAllUris, compare,compareObjects, compareSchemes, compareConcepts, isConcept, isScheme, isContainedIn, isSchemeInList, sortConcepts, sortSchemes, minifyMapping, mappingTypes, mappingTypeByUri, mappingTypeByType, flattenMapping, mappingCSV, defaultMappingType, conceptsOfMapping, compareMappingsDeep, objectTypes, guessObjectType, matchObjectTypes, mergeUris, merge, normalize, isValidUri, compareFunctions, userOwnsMapping, notation, languageMapContent, prefLabel, definition, mappingRegistryIsStored, annotationCreatorUri, annotationCreatorName, annotationCreatorMatches, guessSchemeFromNotation, | ||
} |
{ | ||
"name": "jskos-tools", | ||
"version": "1.0.32", | ||
"version": "1.0.33", | ||
"description": "Tools for working with the JSKOS data format.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/gbv/jskos-tools", |
@@ -46,2 +46,3 @@ # JSKOS Tools | ||
- [guessObjectType](#guessobjecttype) | ||
- [guessSchemeFromNotation](#guessschemefromnotation) | ||
- [objectTypes](#objecttypes) | ||
@@ -380,2 +381,10 @@ - [matchObjectTypes](#matchobjecttypes) | ||
#### guessSchemeFromNotation | ||
Filter a list of concept schemes with a given notation to guess which scheme(s) the notation origins from. Schemes without `notationPattern` or default pattern `.+` are ignored. Returns a (posssibly empty) array of concept schemes. | ||
```js | ||
matchingSchemes = guessSchemeFromNotation(notation, schemes) | ||
``` | ||
#### compareFunctions | ||
@@ -382,0 +391,0 @@ |
133949
3587
487