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

truepixabay

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

truepixabay - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

14

dist/structure/Client.js

@@ -5,2 +5,3 @@ "use strict";

const Constants_1 = require("../util/Constants");
const querystring_1 = require("querystring");
class Client {

@@ -14,3 +15,4 @@ constructor(options) {

async getImages(options) {
const cached = this._imageCache.get(options);
const stringVersion = this._stringifyQuery(options);
const cached = this._imageCache.get(stringVersion);
if (cached) {

@@ -25,3 +27,3 @@ const difference = Date.now() - cached.timestamp;

if (this._isImageResponse(result)) {
this._imageCache.set(options, { timestamp: Date.now(), image: result });
this._imageCache.set(stringVersion, { timestamp: Date.now(), image: result });
return result;

@@ -34,3 +36,4 @@ }

async getVideos(options) {
const cached = this._videoCache.get(options);
const stringVersion = this._stringifyQuery(options);
const cached = this._videoCache.get(stringVersion);
if (cached) {

@@ -45,3 +48,3 @@ const difference = Date.now() - cached.timestamp;

if (!this._isImageResponse(result)) {
this._videoCache.set(options, { timestamp: Date.now(), video: result });
this._videoCache.set(stringVersion, { timestamp: Date.now(), video: result });
return result;

@@ -53,2 +56,5 @@ }

}
_stringifyQuery(obj) {
return querystring_1.stringify(obj);
}
_isImageResponse(arg) {

@@ -55,0 +61,0 @@ return !arg.hits[0].duration;

@@ -27,4 +27,5 @@ import { VideoResponse, ImageResponse } from './PixabayResponses';

getVideos(options: VideoQuery): Promise<VideoResponse>;
private _stringifyQuery(obj);
private _isImageResponse(arg);
private _makeRequest(request);
}
{
"name": "truepixabay",
"version": "1.0.3",
"version": "1.0.4",
"description": "a library to interact with pixabay api.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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