New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

imdb-api

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imdb-api - npm Package Compare versions

Comparing version 4.0.0 to 4.0.2

.nyc_output/11b4521c-570f-476d-b1ee-c41ec9812311.json

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# Version 4.0.0 -> 4.0.1
* Fixes #63, #65 - Be more tolerant of bad data
# Version 3.1.2 -> 4.0.0

@@ -2,0 +6,0 @@

2

lib/imdb.d.ts

@@ -38,3 +38,3 @@ import { OmdbEpisode, OmdbMovie, OmdbSearch, OmdbSearchResult, OmdbTvshow } from "./interfaces";

actors: string;
released: Date;
released?: Date;
name: string;

@@ -41,0 +41,0 @@ protected _year_data: string;

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {

@@ -12,9 +15,12 @@ extendStatics(d, b);

})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};

@@ -58,12 +64,12 @@ Object.defineProperty(exports, "__esModule", { value: true });

if (isNaN(val.getTime())) {
throw new TypeError("invalid release date");
this.released = undefined;
}
this.released = val;
else {
this.released = val;
}
}
else if (attr === "imdbRating") {
var key = trans_table[attr];
var val = parseFloat(obj[attr]);
if (isNaN(val)) {
throw new TypeError("invalid rating");
}
this[trans_table[attr]] = parseFloat(obj[attr]);
this[key] = isNaN(val) ? 0 : val;
}

@@ -107,3 +113,3 @@ else if (trans_table[attr] !== undefined) {

_this.start_year = parseInt(years[0], 10);
_this.end_year = parseInt(years[1], 10) ? parseInt(years[1], 10) : null;
_this.end_year = parseInt(years[1], 10) ? parseInt(years[1], 10) : undefined;
_this.totalseasons = parseInt(obj.totalSeasons, 10);

@@ -110,0 +116,0 @@ _this.opts = opts;

@@ -5,3 +5,3 @@ {

"description": "Queries unofficial imdb APIs to get movie and television information from imdb",
"version": "4.0.0",
"version": "4.0.2",
"main": "./lib/imdb.js",

@@ -17,2 +17,4 @@ "types": "./lib/imdb.d.ts",

"build": "tsc -p .",
"prepare": "npm run build",
"prepublish": "npm run build",
"prepublishOnly": "npm run build",

@@ -27,14 +29,14 @@ "lint": "tslint --project tsconfig.json",

"devDependencies": {
"@types/chai": "^4.1.3",
"@types/mocha": "^5.2.0",
"@types/chai": "^4.1.4",
"@types/mocha": "^5.2.5",
"chai": "^4.1.2",
"coveralls": "^3.0.1",
"coveralls": "^3.0.2",
"js-beautify": "^1.7.5",
"mocha": "^5.1.1",
"nock": "^9.2.6",
"nyc": "^11.8.0",
"ts-node": "^6.0.3",
"tslint": "^5.10.0",
"mocha": "^5.2.0",
"nock": "^9.5.0",
"nyc": "^13.0.1",
"ts-node": "^7.0.0",
"tslint": "^5.11.0",
"typedoc": "^0.11.1",
"typescript": "^2.9.1"
"typescript": "^3.0.1"
},

@@ -53,7 +55,7 @@ "optionalDependencies": {},

"dependencies": {
"@types/request": "^2.47.0",
"@types/request-promise-native": "^1.0.14",
"request": "^2.86.0",
"@types/request": "^2.47.1",
"@types/request-promise-native": "^1.0.15",
"request": "^2.87.0",
"request-promise-native": "^1.0.5"
}
}

@@ -178,3 +178,3 @@ "use strict";

/** date that the movie was originally released */
public released: Date;
public released?: Date;
/** title of the movie */

@@ -213,11 +213,10 @@ public name: string;

if (isNaN(val.getTime())) {
throw new TypeError("invalid release date");
this.released = undefined;
} else {
this.released = val;
}
this.released = val;
} else if (attr === "imdbRating") {
const key = trans_table[attr];
const val = parseFloat(obj[attr]);
if (isNaN(val)) {
throw new TypeError("invalid rating");
}
this[trans_table[attr]] = parseFloat(obj[attr]);
this[key] = isNaN(val) ? 0 : val;
} else if (trans_table[attr] !== undefined) {

@@ -303,3 +302,3 @@ this[trans_table[attr]] = obj[attr];

this.start_year = parseInt(years[0], 10);
this.end_year = parseInt(years[1], 10) ? parseInt(years[1], 10) : null;
this.end_year = parseInt(years[1], 10) ? parseInt(years[1], 10) : undefined;
this.totalseasons = parseInt(obj.totalSeasons, 10);

@@ -306,0 +305,0 @@ this.opts = opts;

@@ -90,9 +90,9 @@ import mocha = require("mocha");

});
it("creates a movie with invalid score", () => {
const mov = Object.assign(Object.create(orig_movie), {imdbRating: "foo"});
assert.throws(() => new imdb.Movie(mov), TypeError);
it("creates a movie with invalid rating", () => {
const mov = Object.assign(Object.create(orig_movie), {imdbRating: "N/A"});
assert.equal(new imdb.Movie(mov).rating, 0);
});
it("creates a movie with bad release data", () => {
const mov = Object.assign(Object.create(orig_movie), {Released: "foo"});
assert.throws(() => new imdb.Movie(mov), TypeError);
it("creates a movie with bad release date", () => {
const mov = Object.assign(Object.create(orig_movie), {Released: "N/A"});
assert.isUndefined(new imdb.Movie(mov).released);
});

@@ -156,3 +156,3 @@ it("creates a movie with no year", () => {

const ep = Object.assign(Object.create(orig_tv), {Released: "foo"});
assert.throws(() => new imdb.Episode(ep, 30), TypeError);
assert.isUndefined(new imdb.Episode(ep, 30).released);
});

@@ -159,0 +159,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc