name-to-imdb
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -106,2 +106,11 @@ var helpers = {} | ||
helpers.parseSearchTerm = function(searchTerm) { | ||
if (!searchTerm || typeof searchTerm !== 'string') return null; | ||
var diacritics = require('diacritics').remove; | ||
var res = searchTerm.replace(/[^\u0000-\u036F][ \t]*/gm, ''); | ||
return diacritics(res); | ||
} | ||
module.exports = helpers |
@@ -1,3 +0,3 @@ | ||
var namedQueue = require('named-queue'); | ||
var helpers = require('./helpers') | ||
const namedQueue = require('named-queue'); | ||
const helpers = require('./helpers'); | ||
@@ -26,3 +26,3 @@ var providers = { | ||
var q = { name: args.name } | ||
var q = { name: helpers.parseSearchTerm(args.name) } | ||
if (args.year) q.year = args.year | ||
@@ -41,4 +41,3 @@ if (args.type) q.type = args.type | ||
return cb(null, null) // no match for other types | ||
var key = new Buffer(args.hintUrl || Object.values(q).join(':')).toString('ascii') // convert to ASCII since EventEmitter bugs with UTF8 | ||
var key = new Buffer.from(args.hintUrl || Object.values(q).join(':')).toString('ascii') // convert to ASCII since EventEmitter bugs with UTF8 | ||
@@ -45,0 +44,0 @@ if (cache.hasOwnProperty(key) && Date.now()-cacheLastSet[key] < CACHE_TTL) { |
{ | ||
"name": "name-to-imdb", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Finds IMDB ID by movie/series name (fuzzily) and optionally year and type", | ||
@@ -26,2 +26,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"diacritics": "~1.3.0", | ||
"named-queue": "^2.1.0", | ||
@@ -28,0 +29,0 @@ "needle": "^1.1.2", |
@@ -1,2 +0,1 @@ | ||
var needle = require("needle") | ||
@@ -3,0 +2,0 @@ var helpers = require("../helpers") |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17044
340
4
+ Addeddiacritics@~1.3.0
+ Addeddiacritics@1.3.0(transitive)