diff --git a/index.js b/index.js index 70eb7ee..6da5b31 100644 --- a/index.js +++ b/index.js @@ -13,8 +13,8 @@ function Query(queryObj) { this.host = queryObj.host || "www.linkedin.com"; //api handles strings with spaces by replacing the values with %20 - this.keyword = queryObj.keyword?.replace(" ", "+") || ""; - this.location = queryObj.location?.replace(" ", "+") || ""; + this.keyword = queryObj.keyword?.trim().replace(" ", "+") || ""; + this.location = queryObj.location?.trim().replace(" ", "+") || ""; this.dateSincePosted = queryObj.dateSincePosted || ""; this.jobType = queryObj.jobType || ""; this.remoteFilter = queryObj.remoteFilter || ""; diff --git a/package.json b/package.json index 2a1f6bb..4333eb2 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "linkedin-jobs-api", - "version": "1.0.1", + "version": "1.0.2", "description": "advanced node.js package for getting job listings from LinkedIn", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "node test.js" }, "repository": { "type": "git", diff --git a/test.js b/test.js index 89dc391..dd25249 100644 --- a/test.js +++ b/test.js @@ -1,7 +1,7 @@ const linkedIn = require("./index"); const queryOptions = { - keyword: "HR", + keyword: "", location: "India", dateSincePosted: "past Week", jobType: "full time",