diff --git a/.gitignore b/.gitignore index b88cf86..5cba9e4 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ Temporary Items # Node.js node_modules +/package-lock.json \ No newline at end of file diff --git a/index.js b/index.js index 8ba7a4d..1f0a5d6 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.GurbaniNow=r():e.GurbaniNow=r()}(this,function(){return function(e){function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var t={};return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=0)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i=r.API_URL="https://api.gurbaninow.com/v2/";r.TYPES=["First Letter Start (Gurmukhi/Unicode)","First Letter Anywhere (Gurmukhi/Unicode)","Full Word/Line (Gurmukhi)","Full Word/Line (English)","Search All Words (Gurmukhi)","Search All Words (English)","Search Any Words (Gurmukhi)","Search Any Words (English)"],r.SOURCES={G:"Sri Guru Granth Sahib Ji",D:"Sri Dasam Granth",B:"Bhai Gurdas Ji Vaaran",N:"Bhai Nand Lal Ji Guzals",A:"Amrit Keertan",U:"Uggardanti"},r.buildApiUrl=function(e){var r=e.q,t=void 0!==r&&r,n=e.source,o=void 0!==n&&n,u=e.type,a=void 0!==u&&u,s=e.writer,d=void 0!==s&&s,c=e.raag,l=void 0!==c&&c,h=e.ang,f=void 0!==h&&h,p=e.results,v=void 0!==p&&p,m=e.offset,b=void 0!==m&&m,y=e.id,g=void 0!==y&&y,G=e.hukam,S=void 0!==G&&G,k=e.unicode,w=void 0!==k&&k,x=e.akhar,A=void 0!==x&&x,j=i;if(!1!==t){var U=[];o&&U.push("source="+o),a&&U.push("searchtype="+a),d&&U.push("writer="+d),l&&U.push("raag="+l),f&&U.push("ang="+f),v&&U.push("results="+v),b&&U.push("offset="+b),j+="search/"+t+"?"+U.join("&")}else if(!1!==g)j+="shabad/"+g;else if(!1!==f)j+="ang/"+f+"/"+(o||"");else if(!1!==S)j+="hukamnama/today";else if(!1!==w)j+="convert/unicode/"+w;else{if(!1===A)throw new Error("Invalid Options Sent");j+="convert/akhar/"+A}return j}}])}); \ No newline at end of file +!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.GurbaniNow=r():e.GurbaniNow=r()}("undefined"!=typeof self?self:this,function(){return function(e){function r(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var o={};return r.m=e,r.c=o,r.d=function(e,o,t){r.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:t})},r.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(o,"a",o),o},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=0)}([function(e,r,o){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.buildApiUrl=r.SOURCES=r.TYPES=void 0;var t=["First Letter Start (Gurmukhi/Unicode)","First Letter Anywhere (Gurmukhi/Unicode)","Full Word/Line (Gurmukhi)","Full Word/Line (English)","Search All Words (Gurmukhi)","Search All Words (English)","Search Any Words (Gurmukhi)","Search Any Words (English)"];r.TYPES=t;var n={G:"Sri Guru Granth Sahib Ji",D:"Sri Dasam Granth",B:"Bhai Gurdas Ji Vaaran",N:"Bhai Nand Lal Ji Guzals",A:"Amrit Keertan",U:"Uggardanti"};r.SOURCES=n;var i=function(e){var r=e.q,o=void 0!==r&&r,t=e.source,n=void 0!==t&&t,i=e.type,a=void 0!==i&&i,u=e.writer,c=void 0!==u&&u,s=e.raag,d=void 0!==s&&s,l=e.ang,f=void 0!==l&&l,h=e.results,p=void 0!==h&&h,v=e.offset,m=void 0!==v&&v,b=e.id,y=void 0!==b&&b,S=e.hukam,g=void 0!==S&&S,G=e.unicode,A=void 0!==G&&G,k=e.akhar,w=void 0!==k&&k,x=e.API_URL,U=void 0===x?"https://api.gurbaninow.com/v2/":x,E=U;if(!1!==o){var j=[];n&&j.push("source=".concat(n)),a&&j.push("searchtype=".concat(a)),c&&j.push("writer=".concat(c)),d&&j.push("raag=".concat(d)),f&&j.push("ang=".concat(f)),p&&j.push("results=".concat(p)),m&&j.push("offset=".concat(m)),E+="search/".concat(o,"?").concat(j.join("&"))}else if(!1!==y)E+="shabad/".concat(y);else if(!1!==f)E+="ang/".concat(f,"/").concat(n||"");else if(!1!==g)E+="hukamnama/today";else if(!1!==A)E+="convert/unicode/".concat(A);else{if(!1===w)throw new Error("Invalid Options Sent");E+="convert/akhar/".concat(w)}return E};r.buildApiUrl=i}])}); \ No newline at end of file diff --git a/package.json b/package.json index 14f859d..bd010a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gurbaninow", - "version": "1.0.0", + "version": "1.0.1", "description": "A JavaScript Wrapper for the GurbaniNow API", "main": "index.js", "scripts": { @@ -18,14 +18,14 @@ }, "homepage": "https://github.com/GurbaniNow/gurbaninowapi-js", "devDependencies": { - "babel-core": "^6.23.1", - "babel-loader": "^6.4.0", - "babel-preset-env": "^1.2.1", - "webpack": "^2.2.1" + "@babel/core": "^7.0.0-beta.40", + "@babel/preset-env": "^7.0.0-beta.40", + "babel-loader": "^8.0.0-beta.0", + "webpack": "^3.11.0" }, "babel": { "presets": [ - "env" + "@babel/preset-env" ] } } diff --git a/src/index.js b/src/index.js index 32db760..b9f1043 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,3 @@ -export const API_URL = `https://api.gurbaninow.com/v2/`; - export const TYPES = [ 'First Letter Start (Gurmukhi/Unicode)', 'First Letter Anywhere (Gurmukhi/Unicode)', @@ -34,6 +32,7 @@ export const buildApiUrl = options => { hukam = false, // Boolean: Pass true if you want hukamnama of today. unicode = false, // Boolean: Pass true to convert query string (GurbaniAkhar) into unicode text. akhar = false, // Boolean: Pass true to convert query string (Unicode) into GurbaniAkhar text. + API_URL = 'https://api.gurbaninow.com/v2/', // String: API_URL to hit. } = options; let url = API_URL; if (q !== false) {