bahai-reflib-data
Advanced tools
Comparing version 0.3.2 to 0.4.0
# CHANGES for `bahai-reflib-data` | ||
## 0.4.0 | ||
- feat: adds `getWorkNames`, `getSectionNamesForWork` | ||
## 0.3.2 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "bahai-reflib-data", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"author": "Brett Zamir <brettz9@yahoo.com>", | ||
@@ -5,0 +5,0 @@ "contributors": [], |
import { | ||
getIdsToSectionsAndParagraphs, getSectionsAndParagraphsToIds, getSections | ||
getIdsToSectionsAndParagraphs, getSectionsAndParagraphsToIds, getSections, | ||
getWorks | ||
} from './getData.js'; | ||
@@ -78,2 +79,28 @@ | ||
/** | ||
* @returns {string[]} | ||
*/ | ||
async function getWorkNames () { | ||
const works = (await getWorks()).map(({title}) => { | ||
return title; | ||
}); | ||
return works; | ||
} | ||
/** | ||
* @param {string} work | ||
* @returns {string[]} | ||
*/ | ||
async function getSectionNamesForWork (work) { | ||
const sections = await getSections(); | ||
return sections.subSections.filter(({parentUrl}) => { | ||
const mainSection = sections.mainSections.find(({title}) => { | ||
return title === work; | ||
}); | ||
return mainSection && mainSection.parentUrl === parentUrl; | ||
}).map(({title}) => { | ||
return title; | ||
}); | ||
} | ||
export { | ||
@@ -85,3 +112,5 @@ getWorkSectionAndParagraphForId, | ||
getInfoForId, | ||
getUrlForId | ||
getUrlForId, | ||
getWorkNames, | ||
getSectionNamesForWork | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7330482
297428