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.1.0 to 0.2.0

CHANGES.md

4

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

@@ -58,3 +58,3 @@ "contributors": [],

},
"readme": "# bahai-reflib-data\n\nThis project aims to host information on the official Bahá'í Reference Library\nwebsite, in particular its unique identifiers, and host scripts for obtaining\nand processing those IDs, such as to map them to paragraph number.\n\nPer <https://bahai-library.com/uhj_additional_tablets_urls>, it seems that the\nURLS hosted on <https://bahai.org/library> may now be permanent, and it is\nhoped that since the paragraphs are not transparent, that the IDs might be\npermanent as well.\n\nOne bit of info: typing <https://bahai.org/r/[ID]> and replacing `[ID]` with\nthe unique ID will redirect to the URL and potentially anchor that it\ntargets.\n\n***Note that this is a work in progress. Currently only hosts data for\nthe Rashḥ-i-‘Amá, though we can gather the IDs by adding (or crawling for)\nmore titles with their URL metadata.***\n\n## Development\n\n1. `npm i -g pnpm` (If you don't have it installed already)\n1. `pnpm i` (Install dependencies)\n1. `pnpm build-data` followed by any of these optional arguments (though\n choosing at least one):\n `mainCollections`, `collections`, `works`, `sections`, `paragraphIdInfo` to\n run the (throttled) downloading and saving of the information\n\n## To-dos\n\n1. **Repopulate paragraph-ID mapping** per new algorithm\n1. Put online as a **JSON service** (using, e.g., Bahaipedia and Bahai9 links)\n1. Put online as a **web app**, allowing a series of pull-downs for work, section,\n and paragraph number to get the ID and link.\n1. Utilize in restoration of **webextensions**-based Bahá'í Reference Library\n Wiki Overlay add-on\n\n## Possible to-dos\n\n1. API to **get ID or work/section/paragraph info for URL**\n1. **RSS feed for new additions** to the library (based on a date-detected field)\n"
"readme": "# bahai-reflib-data\n\nThis project aims to host information on the official Bahá'í Reference Library\nwebsite, in particular its unique identifiers, and host scripts for obtaining\nand processing those IDs, such as to map them to paragraph number.\n\nPer <https://bahai-library.com/uhj_additional_tablets_urls>, it seems that the\nURLS hosted on <https://bahai.org/library> may now be permanent, and it is\nhoped that since the paragraphs are not transparent, that the IDs might be\npermanent as well.\n\nOne bit of info: typing <https://bahai.org/r/[ID]> and replacing `[ID]` with\nthe unique ID will redirect to the URL and potentially anchor that it\ntargets.\n\n## Development\n\n1. `npm i -g pnpm` (If you don't have it installed already)\n1. `pnpm i` (Install dependencies)\n1. `pnpm build-data` followed by any of these optional arguments (though\n choosing at least one):\n `mainCollections`, `collections`, `works`, `sections`, `paragraphIdInfo` to\n run the (throttled) downloading and saving of the information\n\n## To-dos\n\n1. Put online as a **JSON service** (using, e.g., for Bahaipedia and Bahai9\n links)\n1. Put online as a **web app**, allowing a series of pull-downs for work,\n section, and paragraph number to get the ID and link.\n1. Utilize in restoration of **webextensions**-based Bahá'í Reference Library\n Wiki Overlay add-on\n\n## Possible to-dos\n\n1. **RSS feed for new additions** to the library (based on a date-detected\n field)\n"
}

@@ -16,6 +16,2 @@ # bahai-reflib-data

***Note that this is a work in progress. Currently only hosts data for
the Rashḥ-i-‘Amá, though we can gather the IDs by adding (or crawling for)
more titles with their URL metadata.***
## Development

@@ -32,6 +28,6 @@

1. **Repopulate paragraph-ID mapping** per new algorithm
1. Put online as a **JSON service** (using, e.g., Bahaipedia and Bahai9 links)
1. Put online as a **web app**, allowing a series of pull-downs for work, section,
and paragraph number to get the ID and link.
1. Put online as a **JSON service** (using, e.g., for Bahaipedia and Bahai9
links)
1. Put online as a **web app**, allowing a series of pull-downs for work,
section, and paragraph number to get the ID and link.
1. Utilize in restoration of **webextensions**-based Bahá'í Reference Library

@@ -42,3 +38,3 @@ Wiki Overlay add-on

1. API to **get ID or work/section/paragraph info for URL**
1. **RSS feed for new additions** to the library (based on a date-detected field)
1. **RSS feed for new additions** to the library (based on a date-detected
field)
import {
getIdsToSectionsAndParagraphs, getSectionsAndParagraphsToIds
getIdsToSectionsAndParagraphs, getSectionsAndParagraphsToIds, getSections
} from './getData.js';

@@ -23,5 +23,31 @@

/**
* @param {string} url
* @returns {string|undefined}
*/
async function getIdForUrl (url) {
return (await getInfoForUrl(url))?.id;
}
/**
* @param {string} url
* @returns {string|undefined}
*/
async function getInfoForUrl (url) {
const sections = await getSections();
const found = sections.mainSections.find(({url: mainSectionUrl}) => {
return mainSectionUrl === url;
});
return found || sections.subSections.find(({url: subSectionUrl}) => {
return subSectionUrl === url;
});
}
export {
getWorkSectionAndParagraphForId,
getIdForWorkSectionAndParagraph
getIdForWorkSectionAndParagraph,
getIdForUrl,
getInfoForUrl
};
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