-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
1 lines (1 loc) · 2.46 KB
/
index.js
1
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Khajana=r():e.Khajana=r()}("undefined"!=typeof self?self:this,function(){return function(e){function r(t){if(n[t])return n[t].exports;var a=n[t]={i:t,l:!1,exports:{}};return e[t].call(a.exports,a,a.exports,r),a.l=!0,a.exports}var n={};return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=0)}([function(e,r,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),n.d(r,"TYPES",function(){return t}),n.d(r,"SOURCES",function(){return a}),n.d(r,"SOURCES_WITH_ANG",function(){return o}),n.d(r,"buildApiUrl",function(){return i});var t=["First letter each word from start (Gurmukhi)","First letter each word anywhere (Gurmukhi)","Full Word (Gurmukhi)","Full Word Translation (English)","Romanized Gurmukhi (English)","Ang","Main Letters (Gurmukhi)","Romanized first letter anywhere (English)"],a={all:"All Sources",G:"Guru Granth Sahib Ji",D:"Dasam Granth Sahib",B:"Bhai Gurdas Ji Vaaran",A:"Amrit Keertan",S:"Bhai Gurdas Singh Ji Vaaran",N:"Bhai Nand Lal Ji Vaaran",R:"Rehatnamas & Panthic Sources"},o={G:a.G,D:a.D,B:a.B,S:a.S},i=function(e){var r=e.q,n=void 0!==r&&r,t=e.source,a=void 0!==t&&t,o=e.type,i=void 0!==o&&o,u=e.writer,c=void 0!==u&&u,s=e.raag,d=void 0!==s&&s,l=e.ang,h=void 0!==l&&l,f=e.results,p=void 0!==f&&f,v=e.offset,m=void 0!==v&&v,b=e.id,G=void 0!==b&&b,g=e.hukam,y=void 0!==g&&g,S=e.akhar,j=void 0!==S&&S,k=e.lipi,w=void 0!==k&&k,x=e.random,A=void 0!==x&&x,E=e.randomid,R=void 0!==E&&E,_=e.API_URL,B=void 0===_?"https://api.banidb.com/v2":_,O=e.livesearch,P=void 0!==O&&O,D=B;if(!1!==n){var F=[];a&&F.push("source=".concat(a)),i&&F.push("searchtype=".concat(i)),c&&F.push("writer=".concat(c)),d&&F.push("raag=".concat(d)),h&&F.push("ang=".concat(h)),p&&F.push("results=".concat(p)),m&&F.push("page=".concat(m)),P&&F.push("livesearch=1"),D+="search/".concat(n,"?").concat(F.join("&"))}else if(!1!==G)D+="shabads/".concat(G);else if(!1!==h)D+="angs/".concat(h,"/").concat(a||"");else if(!1!==y)D+="hukamnamas/".concat(y);else if(!1!==j&&!1!==w)D+="akhar/".concat(w);else if(!1!==R)D+="random/id";else{if(!1===A)throw new Error("Invalid options sent");D+="random"}return D}}])});