Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bahai-reflib-data

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bahai-reflib-data - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

6

CHANGES.md
# CHANGES for `bahai-reflib-data`
## 0.7.0
- feat: add `getSubsectionUrlForWork`
- feat: add `getUrlForWork`
- fix: build
## 0.6.0

@@ -4,0 +10,0 @@

2

package.json
{
"name": "bahai-reflib-data",
"version": "0.6.0",
"version": "0.7.0",
"author": "Brett Zamir <brettz9@yahoo.com>",

@@ -5,0 +5,0 @@ "contributors": [],

@@ -56,3 +56,3 @@ import {

* @param {"fa"|"en"} [language] If none is provided, will check all languages
* @returns {string|undefined}
* @returns {Promise<string|undefined>}
*/

@@ -92,3 +92,3 @@ async function getIdForUrl (url, language) {

* @param {"fa"|"en"} [language] If none is provided, will check all languages
* @returns {string[]}
* @returns {Promise<string[]>}
*/

@@ -105,3 +105,3 @@ async function getWorkNames (language) {

* @param {"fa"|"en"} [language] If none is provided, will check all languages
* @returns {string[]}
* @returns {Promise<string[]>}
*/

@@ -123,5 +123,10 @@ async function getSectionNamesForWork (work, language) {

}) => {
return mainSectionParentUrl === works.find(({url, title}) => {
const found = works.find(({url, title}) => {
return work === title;
}).url;
});
/* c8 ignore next 3 */
if (!found) {
return false;
}
return mainSectionParentUrl === found.url;
});

@@ -134,2 +139,41 @@ return mainSection && mainSection.parentUrl === parentUrl;

/**
* @param {string} work
* @param {"fa"|"en"} [language] If none is provided, will check all languages
* @returns {Promise<string>}
*/
async function getUrlForWork (work, language) {
const found = (await getWorks(language)).find(({title}) => {
return title === work;
});
return found && found.url;
}
/**
* @param {string} work
* @param {"fa"|"en"} [language] If none is provided, will check all languages
* @returns {Promise<string>}
*/
async function getSubsectionUrlForWork (work, language) {
const [works, sections] = await Promise.all([
getWorks(language),
getSections(language)
]);
const found = sections.mainSections.find(({
parentUrl: mainSectionParentUrl
}) => {
const innerFound = works.find(({url, title}) => {
return work === title;
});
/* c8 ignore next 3 */
if (!innerFound) {
return false;
}
return mainSectionParentUrl === innerFound.url;
});
return found && found.url;
}
export {

@@ -143,3 +187,5 @@ getWorkSectionAndParagraphForId,

getWorkNames,
getSectionNamesForWork
getSectionNamesForWork,
getUrlForWork,
getSubsectionUrlForWork
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc