npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@anchovy_studios/alkitab

v0.1.1

Published

Indonesian Holy Bible

Downloads

19

Readme

alkitab

npm GitHub issues NPM

Holy Bible in Indonesian.

Requirement

Node.js 12.0.0 or higher

Installation

Installation is done using the npm install command:

$ npm install @anchovy_studios/alkitab

Quick Start

const { Alkitab } = require('@anchovy_studios/alkitab')

// create new instance
const myAlkitab = new Alkitab()

// or using static method
Alkitab.getVersion(true)

Static Methods

getVersion(log)

Get the installed version of this library and the latest version from npm registry

  • log : if true, print and return the result to the console. if false, return only the result. The default value is false.
// print also
Alkitab.getVersion(true)

//without print
console.log(Alkitab.getVersion())

OUTPUT

// with log = true
Checking npm registry ...
Hi ^-^
Your current version is 0.0.1.
The latest version is 1.0.0. Consider updating your library with npm install command.

// with log = false
{
  current: '0.0.1',
  latest: '1.0.0',
  message: 'Hi ^-^\n' +
    'Your current version is 0.0.1.\n' +
    'The latest version is \u001b[33m1.0.0\u001b[0m. Consider updating your library with \u001b[32mnpm install\u001b[0m command.'
}

getBookList(sorted)

Get the list of valid and available book that can be used in getVerse(book, chapter, verse, options), getVerseByQuery(query, options), or getVerseByOptions(options)

  • sorted : if true, get list in sorted order according the Bible order. false otherwise. The default value is false.
// without sorted
console.log(Alkitab.getBookList())

// with sorted
console.log(Alkitab.getBookList(true))

OUTPUT

// without sorted
[
  '1 Korintus',   '1 Petrus',         '1 Raja-raja',
  '1 Samuel',     '1 Tawarikh',       '1 Tesalonika',
  '1 Timotius',   '1 Yohanes',        '2 Korintus',
  ...
]

// with sorted
[
  'Kejadian',     'Keluaran',         'Imamat',
  'Bilangan',     'Ulangan',          'Yosua',
  'Hakim-hakim',  'Rut',              '1 Samuel',
  ...
]

Methods

getInstanceError() (DEPRECATED)

DEPRECATED since 0.1.0

(Old) Get all errors produce by this instance only. Returns an array of AlkitabException object.

(Now) Returns an empty array

// old
console.log(myAlkitab.getInstanceError())

//now
console.log(myAlkitab.getInstanceError())

OUTPUT

// old
[
  AlkitabException:
  Oopps!! Error detected!!
  We're sorry we can not find the book of adf in our database. Please check again the book list on our home page or use Alkitab.getBookList() static method.
  Cause: Book not found!
  Native error: undefined
  Time: Friday, May 08, 2020, 06:26:29 PM

      at Alkitab.getAllErrors (E:\alkitab\app.js:90:29)
      at Object.<anonymous> (E:\alkitab\app.js:167:15)
      at Module._compile (internal/modules/cjs/loader.js:959:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
      ...
]

//now
[]

getAllErrors(formatted, maxTime)

Get all errors that ever happen since you install this library. The actual files can be found in logs/. The errors will be an instance of AlkitabException object. This method will delete all the log files from the beginning until the time specified in the parameter.

  • formatted : if true returns an array of AlkitabException object. if false returns an array of raw string error logs. The default value is false.
  • maxTime : the maximum time for log files to be deleted. The default value is now using the new Date().getTime() function.
console.log(myAlkitab.getAllErrors())
console.log(myAlkitab.getAllErrors(true))

OUTPUT

// with formatted = false
[
  "Friday, May 08, 2020, 05:05:38 PM | We're sorry we can not find the book of adf in our database. Please check again the book list on our home page or use Alkitab.getBookList() static method. | Cause: Book not found! | Native error: undefined",
  "...",
  ...
]

// with formatted = true
[
  AlkitabException:
  Oopps!! Error detected!!
  We're sorry we can not find the book of adf in our database. Please check again the book list on our home page or use Alkitab.getBookList() static method.
  Cause: Book not found!
  Native error: undefined
  Time: Friday, May 08, 2020, 06:26:29 PM

      at Alkitab.getAllErrors (E:\alkitab\app.js:90:29)
      at Object.<anonymous> (E:\alkitab\app.js:167:15)
      at Module._compile (internal/modules/cjs/loader.js:959:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
      ...
  },

clearErrors(maxTime)

Clear all error within the /logs folder until the specified time.

  • maxTime : an integer value represent the millisecond time. Use the Date.getTime() function to get this value. The default value is now using the new Date().getTime() function.
console.log(myAlkitab.clearErrors(new Date('2020-05-01').getTime()))

OUTPUT

[
  '1838900000000.log',
  '1839000000000.log',
  ...
]

getVerse(book, chapter, verse, options)

Get one verse (as a string) or all verses within a chapter (as an array of stirng) with the specified parameters.

  • book : a string for the Book. Use getListBook() to see all Book option. Make sure the string match exactly with the string from getListBook().
  • chapter : a number (or a string but can be converted to number) for the chapter of the book
  • verse : a number (or a string but can be converted to number) and can be filled with false or undefined to get all the verses in the chapter.
  • options : an object for extra option that contains any of these attribute
    • fromEn : Set this to true to receive the verse in Indonesian if the book is in English.

Throw AlkitabException for every invalid parameters.

console.log(myAlkitab.getVerse('Matius', '1', '1'))
console.log(myAlkitab.getVerse('Matius', '1'))
// will throw an error
console.log(myAlkitab.getVerse('matius', '1'))

OUTPUT

// one verse
Inilah silsilah Yesus Kristus, anak Daud, anak Abraham.

// one chapter
[
  'Inilah silsilah Yesus Kristus, anak Daud, anak Abraham.',
  'Abraham memperanakkan Ishak, Ishak memperanakkan Yakub, Yakub memperanakkan Yehuda dan saudara-saudaranya,',
  'Yehuda memperanakkan Peres dan Zerah dari Tamar, Peres memperanakkan Hezron, Hezron memperanakkan Ram,',
  'Ram memperanakkan Aminadab, Aminadab memperanakkan Nahason, Nahason memperanakkan Salmon,',
  'Salmon memperanakkan Boas dari Rahab, Boas memperanakkan Obed dari Rut, Obed memperanakkan Isai,',
  ...
]

// error
AlkitabException:
Oopps!! Error detected!!
We're sorry we can not find the book of matius in our database. Please check again the book list on our home page or use Alkitab.getBookList() static method.
Cause: Book not found!
Native error: undefined
Time: Friday, May 08, 2020, 06:49:52 PM

    at Alkitab.#parseVerse (E:\alkitab\app.js:45:19)
    at Alkitab.getVerse (E:\alkitab\app.js:57:32)
...

getVerseByQuery(query, options)

Get one verse (as a string) or all verses within a chapter (as an array of stirng) with the full query string. The string must exactly match this format : <book>(space)<chapter>:<verse>

  • query : a query string that match the above format.
  • options : an object for extra option that contains any of these attribute
    • fromEn : Set this to true to receive the verse in Indonesian if the book is in English.

Throw AlkitabException for every invalid parameters.

myAlkitab.getVerseByQuery('Exodus 1:1', {fromEn: true})

// this will cause error because fromEn options was not set
myAlkitab.getVerseByQuery('Exodus 1')

OUTPUT

Inilah nama para anak Israel yang datang ke Mesir bersama-sama dengan Yakub; mereka datang dengan keluarganya masing-masing:

// error
AlkitabException:
Oopps!! Error detected!!
We're sorry we can not find the book of Exodus in our database. Please check again the book list on our home page or use Alkitab.getBookList() static method.
Cause: Book not found!
Native error: undefined
Time: Friday, May 08, 2020, 06:58:05 PM
...

getVersionByOptions(options)

Get one verse (as a string) or all verses within a chapter (as an array of stirng) with the specified parameters as options.

  • options : an object for extra option that contains any of these attribute
    • fromEn : Set this to true to receive the verse in Indonesian if the book is in English.
    • book : a string for the Book. Use getListBook() to see all Book option. Make sure the string match exactly with the string from getListBook().
    • chapter : a number (or a string but can be converted to number) for the chapter of the book
    • verse : a number (or a string but can be converted to number) and can be filled with false or undefined to get all the verses in the chapter.
myAlkitab.getVerseByOptions({book: 'Mazmur', chapter: '3', verse: '1'})

OUTPUT

Mazmur Daud, ketika ia lari dari Absalom, anaknya. (3-2) Ya TUHAN, betapa banyaknya lawanku! Banyak orang yang bangkit menyerang aku;

Change History

CHANGELOG

License

MIT