Comparing version 0.3.2 to 0.3.3
{ | ||
"name": "imdbtr", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "IMDB on terminal", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
'use strict'; | ||
const helpers = require('./helpers'); | ||
const got = require('got'); | ||
@@ -9,17 +10,2 @@ const provider = 'http://www.omdbapi.com/?'; | ||
const normalizeName = name => { | ||
const nameList = name.split(' ', 2); | ||
let normalizedList = []; | ||
if (nameList.length > 1) { | ||
normalizedList = nameList.map(currName => { | ||
return encodeURI(currName); | ||
}); | ||
normalizedList = normalizedList.join('+'); | ||
} | ||
return normalizedList.toString(); | ||
}; | ||
const api = name => { | ||
@@ -30,3 +16,3 @@ if (!name) { | ||
const normalizedName = normalizeName(name); | ||
const normalizedName = helpers.normalizeName(name); | ||
@@ -33,0 +19,0 @@ const movie = got(`${provider}t=${normalizedName}`, {headers, json: true}) |
21518
12
98