Socket
Socket
Sign inDemoInstall

unsplash-js

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unsplash-js - npm Package Compare versions

Comparing version 7.0.18 to 7.0.19

11

dist/unsplash-js.cjs.development.js

@@ -5,4 +5,2 @@ 'use strict';

var ContentTypeHelpers = require('content-type');
function _extends() {

@@ -117,8 +115,9 @@ _extends = Object.assign || function (target) {

var CONTENT_TYPE_RESPONSE_HEADER = 'content-type';
var CONTENT_TYPE_JSON = 'application/json';
var isJSON = function isJSON(contentType) {
return /application\/[^+]*[+]?(json);?.*/.test(contentType);
};
var checkIsJsonResponse = function checkIsJsonResponse(response) {
var contentTypeHeader = response.headers.get(CONTENT_TYPE_RESPONSE_HEADER);
return isDefined(contentTypeHeader) && ContentTypeHelpers.parse(contentTypeHeader).type === CONTENT_TYPE_JSON;
var contentTypeHeader = response.headers.get('content-type');
return isDefined(contentTypeHeader) && isJSON(contentTypeHeader);
};

@@ -125,0 +124,0 @@ /**

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("content-type");function n(){return(n=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function t(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n.indexOf(t=o[r])>=0||(a[t]=e[t]);return a}var r=o((function(e){return"string"==typeof e?e:null})),a=function(e){return null!=e};function o(e){return function(n){return a(e(n))}}var u=function(e){return Object.keys(e).reduce((function(t,r){var o,u=e[r];return n({},t,a(u)?((o={})[r]=u,o):{})}),{})};function i(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=n.length-1;return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];for(var o=n[0].apply(this,t),u=1;u<=r;u++)o=n[u].call(this,o);return o}}var s,c,l=o((function(e){return a(e)&&"object"==typeof e&&!Array.isArray(e)?e:null})),h=o((function(e){return Array.isArray(e)&&e.every(r)&&e.length>0?e:null})),p=o((function(e){return l(e)&&"errors"in e&&h(e.errors)?{errors:e.errors}:null})),d=function(e){this.message=e},f=function(n){if(function(n){var t=n.headers.get("content-type");return a(t)&&"application/json"===e.parse(t).type}(n))return n.json().catch((function(e){throw new d("unable to parse JSON response.")}));throw new d("expected JSON response from server.")},g=function(){return function(e){return f(e.response)}},m=function(e){return function(r,a){void 0===a&&(a={});var o=e(r),u=o.headers,i=o.query;return n({},t(o,["headers","query"]),a,{query:i,headers:n({},u,a.headers)})}},y=function(e){return e},v=function(e){var r=e.accessKey,o=e.apiVersion,u=void 0===o?"v1":o,s=e.apiUrl,c=void 0===s?"https://api.unsplash.com":s,l=e.headers,h=e.fetch,g=t(e,["accessKey","apiVersion","apiUrl","headers","fetch"]);return function(e){var t=e.handleResponse;return i(e.handleRequest,(function(e){var o=e.method,i=void 0===o?"GET":o,s=e.headers,m=e.body,y=e.signal,v=function(e){var n=e.pathname,t=e.query;return function(e){var r=new URL(e);return function(e){return function(n){"/"===n.pathname?n.pathname=e:n.pathname+=e}}(n)(r),function(e){return function(n){Object.keys(e).forEach((function(t){return n.searchParams.set(t,e[t].toString())}))}}(t)(r),r.toString()}}({pathname:e.pathname,query:e.query})(c),q=n({method:i,headers:n({},l,s,{"Accept-Version":u},a(r)?{Authorization:"Client-ID "+r}:{}),body:m,signal:y},g);return(null!=h?h:fetch)(v,q).then(function(e){return function(t){return(t.ok?e({response:t}).then((function(e){return{type:"success",status:t.status,response:e,originalResponse:t}})):f(t).then((function(e){return n({type:"error",status:t.status},function(e){return p(e)?{errors:e.errors,source:"api"}:{errors:["Responded with a status code outside the 2xx range, and the response body is not recognisable."],source:"decoding"}}(e),{originalResponse:t})}))).catch((function(e){if(e instanceof d)return{type:"error",source:"decoding",status:t.status,originalResponse:t,errors:[e.message]};throw e}))}}(t))}))}},q=function(e){var n=e.headers.get("x-total");if(a(n)){var t=parseInt(n);if(Number.isInteger(t))return t;throw new d("expected x-total header to be valid integer.")}throw new d("expected x-total header to exist.")},R=function(){return function(e){var n=e.response;return g()({response:n}).then((function(e){return{results:e,total:q(n)}}))}},P=function(e){return a(e)?{collections:e.join()}:{}},I=function(e){return a(e)?{topics:e.join()}:{}},w=function(e){return u({per_page:e.perPage,order_by:e.orderBy,page:e.page})},_=function(){var e=function(e){return"/collections/"+e.collectionId+"/photos"};return{getPathname:e,handleRequest:m((function(r){var a=r.collectionId,o=r.orientation,i=t(r,["collectionId","orientation"]);return{pathname:e({collectionId:a}),query:u(n({},w(i),{orientation:o}))}})),handleResponse:R()}}(),b=function(){var e=function(e){return"/collections/"+e.collectionId};return{getPathname:e,handleRequest:m((function(n){return{pathname:e({collectionId:n.collectionId}),query:{}}})),handleResponse:g()}}(),k=function(){return{getPathname:function(){return"/collections"},handleRequest:m((function(e){return void 0===e&&(e={}),{pathname:"/collections",query:w(e)}})),handleResponse:R()}}(),S=function(){var e=function(e){return"/collections/"+e.collectionId+"/related"};return{getPathname:e,handleRequest:m((function(n){return{pathname:e({collectionId:n.collectionId}),query:{}}})),handleResponse:g()}}(),O={__proto__:null,getPhotos:_,get:b,list:k,getRelated:S},j=function(){return{getPathname:function(e){return"/photos"},handleRequest:m((function(e){return void 0===e&&(e={}),{pathname:"/photos",query:u(w(e))}})),handleResponse:R()}}(),A=function(){var e=function(e){return"/photos/"+e.photoId};return{getPathname:e,handleRequest:m((function(n){return{pathname:e({photoId:n.photoId}),query:{}}})),handleResponse:g()}}(),x=function(){var e=function(e){return"/photos/"+e.photoId+"/statistics"};return{getPathname:e,handleRequest:m((function(n){return{pathname:e({photoId:n.photoId}),query:{}}})),handleResponse:g()}}(),L=function(){return{getPathname:function(){return"/photos/random"},handleRequest:m((function(e){var r=void 0===e?{}:e,a=r.collectionIds,o=r.contentFilter,i=r.topicIds,s=t(r,["collectionIds","contentFilter","topicIds"]);return{pathname:"/photos/random",query:u(n({},s,{content_filter:o},P(a),I(i))),headers:{"cache-control":"no-cache"}}})),handleResponse:g()}}(),C={handleRequest:m((function(e){var n=function(e){var n=new URL(e),t=n.pathname;return{query:function(e){var n={};return e.forEach((function(e,t){n[t]=e})),n}(n.searchParams),pathname:"/"===t?void 0:t}}(e.downloadLocation),t=n.pathname,r=n.query;if(!a(t))throw new Error("Could not parse pathname from url.");return{pathname:t,query:u(r)}})),handleResponse:g()},T={__proto__:null,list:j,get:A,getStats:x,getRandom:L,trackDownload:C},z=function(){return{getPathname:function(e){return"/search/photos"},handleRequest:m((function(e){var r=e.query,a=e.page,o=e.perPage,i=e.orderBy,s=e.collectionIds,c=e.lang,l=e.contentFilter,h=t(e,["query","page","perPage","orderBy","collectionIds","lang","contentFilter"]);return{pathname:"/search/photos",query:u(n({query:r,content_filter:l,lang:c,order_by:i},w({page:a,perPage:o}),P(s),h))}})),handleResponse:g()}}(),B=function(){return{getPathname:function(e){return"/search/collections"},handleRequest:m((function(e){var r=e.query,a=t(e,["query"]);return{pathname:"/search/collections",query:n({query:r},w(a))}})),handleResponse:g()}}(),E=function(){return{getPathname:function(e){return"/search/users"},handleRequest:m((function(e){var r=e.query,a=t(e,["query"]);return{pathname:"/search/users",query:n({query:r},w(a))}})),handleResponse:g()}}(),U={__proto__:null,getPhotos:z,getCollections:B,getUsers:E},M=function(){var e=function(e){return"/users/"+e.username};return{getPathname:e,handleRequest:m((function(n){return{pathname:e({username:n.username}),query:{}}})),handleResponse:g()}}(),K=function(){var e=function(e){return"/users/"+e.username+"/photos"};return{getPathname:e,handleRequest:m((function(r){var a=r.username,o=r.stats,i=r.orientation,s=t(r,["username","stats","orientation"]);return{pathname:e({username:a}),query:u(n({},w(s),{orientation:i,stats:o}))}})),handleResponse:R()}}(),D=function(){var e=function(e){return"/users/"+e.username+"/likes"};return{getPathname:e,handleRequest:m((function(r){var a=r.username,o=r.orientation,i=t(r,["username","orientation"]);return{pathname:e({username:a}),query:u(n({},w(i),{orientation:o}))}})),handleResponse:R()}}(),F=function(){var e=function(e){return"/users/"+e.username+"/collections"};return{getPathname:e,handleRequest:m((function(n){var r=n.username,a=t(n,["username"]);return{pathname:e({username:r}),query:w(a)}})),handleResponse:R()}}(),H={__proto__:null,get:M,getPhotos:K,getLikes:D,getCollections:F},N=function(e){return"/topics/"+e.topicIdOrSlug},G=y({getPathname:N,handleRequest:function(e){var t=e.orderBy,r=e.topicIdsOrSlugs;return{pathname:"/topics",query:u(n({},w({page:e.page,perPage:e.perPage}),{ids:null==r?void 0:r.join(","),order_by:t}))}},handleResponse:R()}),V=y({getPathname:N,handleRequest:function(e){return{pathname:N({topicIdOrSlug:e.topicIdOrSlug}),query:{}}},handleResponse:g()}),J=function(){var e=i(N,(function(e){return e+"/photos"}));return{getPathname:e,handleRequest:function(r){var a=r.topicIdOrSlug,o=r.orientation,i=t(r,["topicIdOrSlug","orientation"]);return{pathname:e({topicIdOrSlug:a}),query:u(n({},w(i),{orientation:o}))}},handleResponse:R()}}(),W={__proto__:null,collections:O,photos:T,search:U,users:H,topics:{__proto__:null,list:G,get:V,getPhotos:J},trackNonHotLinkedPhotoView:function(e){var n=e.appId;return function(e){var t=e.photoId,r=Array.isArray(t)?t:[t];if(r.length>20)throw new Error("You cannot track more than 20 photos at once. Please try again with fewer photos.");return fetch("views.unsplash.com/v?photo_id="+r.join()+"&app_id="+n)}}};(s=exports.Language||(exports.Language={})).Afrikaans="af",s.Amharic="am",s.Arabic="ar",s.Azerbaijani="az",s.Belarusian="be",s.Bulgarian="bg",s.Bengali="bn",s.Bosnian="bs",s.Catalan="ca",s.Cebuano="ceb",s.Corsican="co",s.Czech="cs",s.Welsh="cy",s.Danish="da",s.German="de",s.Greek="el",s.English="en",s.Esperanto="eo",s.Spanish="es",s.Estonian="et",s.Basque="eu",s.Persian="fa",s.Finnish="fi",s.French="fr",s.Frisian="fy",s.Irish="ga",s.ScotsGaelic="gd",s.Galician="gl",s.Gujarati="gu",s.Hausa="ha",s.Hawaiian="haw",s.Hindi="hi",s.Hmong="hmn",s.Croatian="hr",s.HaitianCreole="ht",s.Hungarian="hu",s.Armenian="hy",s.Indonesian="id",s.Igbo="ig",s.Icelandic="is",s.Italian="it",s.Hebrew="iw",s.Japanese="ja",s.Javanese="jw",s.Georgian="ka",s.Kazakh="kk",s.Khmer="km",s.Kannada="kn",s.Korean="ko",s.Kurdish="ku",s.Kyrgyz="ky",s.Latin="la",s.Luxembourgish="lb",s.Lao="lo",s.Lithuanian="lt",s.Latvian="lv",s.Malagasy="mg",s.Maori="mi",s.Macedonian="mk",s.Malayalam="ml",s.Mongolian="mn",s.Marathi="mr",s.Malay="ms",s.Maltese="mt",s.Myanmar="my",s.Nepali="ne",s.Dutch="nl",s.Norwegian="no",s.Nyanja="ny",s.Oriya="or",s.Punjabi="pa",s.Polish="pl",s.Pashto="ps",s.Portuguese="pt",s.Romanian="ro",s.Russian="ru",s.Kinyarwanda="rw",s.Sindhi="sd",s.Sinhala="si",s.Slovak="sk",s.Slovenian="sl",s.Samoan="sm",s.Shona="sn",s.Somali="so",s.Albanian="sq",s.Serbian="sr",s.Sesotho="st",s.Sundanese="su",s.Swedish="sv",s.Swahili="sw",s.Tamil="ta",s.Telugu="te",s.Tajik="tg",s.Thai="th",s.Turkmen="tk",s.Filipino="tl",s.Turkish="tr",s.Tatar="tt",s.Uighur="ug",s.Ukrainian="uk",s.Urdu="ur",s.Uzbek="uz",s.Vietnamese="vi",s.Xhosa="xh",s.Yiddish="yi",s.Yoruba="yo",s.ChineseSimplified="zh",s.ChineseTraditional="zh-TW",s.Zulu="zu",(c=exports.OrderBy||(exports.OrderBy={})).LATEST="latest",c.POPULAR="popular",c.VIEWS="views",c.DOWNLOADS="downloads",c.OLDEST="oldest";var Y=i(v,(function(e){return{photos:{get:e(A),list:e(j),getStats:e(x),getRandom:e(L),trackDownload:e(C)},users:{getPhotos:e(K),getCollections:e(F),getLikes:e(D),get:e(M)},search:{getCollections:e(B),getPhotos:e(z),getUsers:e(E)},collections:{getPhotos:e(_),get:e(b),list:e(k),getRelated:e(S)},topics:{list:e(G),get:e(V),getPhotos:e(J)}}}));exports._internals=W,exports.createApi=Y;
"use strict";function e(){return(e=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function n(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n.indexOf(t=a[r])>=0||(o[t]=e[t]);return o}Object.defineProperty(exports,"__esModule",{value:!0});var t=o((function(e){return"string"==typeof e?e:null})),r=function(e){return null!=e};function o(e){return function(n){return r(e(n))}}var a=function(n){return Object.keys(n).reduce((function(t,o){var a,u=n[o];return e({},t,r(u)?((a={})[o]=u,a):{})}),{})};function u(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=n.length-1;return function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];for(var a=n[0].apply(this,t),u=1;u<=r;u++)a=n[u].call(this,a);return a}}var i,s,c=o((function(e){return r(e)&&"object"==typeof e&&!Array.isArray(e)?e:null})),l=o((function(e){return Array.isArray(e)&&e.every(t)&&e.length>0?e:null})),h=o((function(e){return c(e)&&"errors"in e&&l(e.errors)?{errors:e.errors}:null})),p=function(e){this.message=e},d=function(e){if(function(e){var n=e.headers.get("content-type");return r(n)&&/application\/[^+]*[+]?(json);?.*/.test(n)}(e))return e.json().catch((function(e){throw new p("unable to parse JSON response.")}));throw new p("expected JSON response from server.")},f=function(){return function(e){return d(e.response)}},g=function(t){return function(r,o){void 0===o&&(o={});var a=t(r),u=a.headers,i=a.query;return e({},n(a,["headers","query"]),o,{query:i,headers:e({},u,o.headers)})}},m=function(e){return e},y=function(t){var o=t.accessKey,a=t.apiVersion,i=void 0===a?"v1":a,s=t.apiUrl,c=void 0===s?"https://api.unsplash.com":s,l=t.headers,f=t.fetch,g=n(t,["accessKey","apiVersion","apiUrl","headers","fetch"]);return function(n){var t=n.handleResponse;return u(n.handleRequest,(function(n){var a=n.method,u=void 0===a?"GET":a,s=n.headers,m=n.body,y=n.signal,v=function(e){var n=e.pathname,t=e.query;return function(e){var r=new URL(e);return function(e){return function(n){"/"===n.pathname?n.pathname=e:n.pathname+=e}}(n)(r),function(e){return function(n){Object.keys(e).forEach((function(t){return n.searchParams.set(t,e[t].toString())}))}}(t)(r),r.toString()}}({pathname:n.pathname,query:n.query})(c),q=e({method:u,headers:e({},l,s,{"Accept-Version":i},r(o)?{Authorization:"Client-ID "+o}:{}),body:m,signal:y},g);return(null!=f?f:fetch)(v,q).then(function(n){return function(t){return(t.ok?n({response:t}).then((function(e){return{type:"success",status:t.status,response:e,originalResponse:t}})):d(t).then((function(n){return e({type:"error",status:t.status},function(e){return h(e)?{errors:e.errors,source:"api"}:{errors:["Responded with a status code outside the 2xx range, and the response body is not recognisable."],source:"decoding"}}(n),{originalResponse:t})}))).catch((function(e){if(e instanceof p)return{type:"error",source:"decoding",status:t.status,originalResponse:t,errors:[e.message]};throw e}))}}(t))}))}},v=function(e){var n=e.headers.get("x-total");if(r(n)){var t=parseInt(n);if(Number.isInteger(t))return t;throw new p("expected x-total header to be valid integer.")}throw new p("expected x-total header to exist.")},q=function(){return function(e){var n=e.response;return f()({response:n}).then((function(e){return{results:e,total:v(n)}}))}},R=function(e){return r(e)?{collections:e.join()}:{}},P=function(e){return r(e)?{topics:e.join()}:{}},I=function(e){return a({per_page:e.perPage,order_by:e.orderBy,page:e.page})},w=function(){var t=function(e){return"/collections/"+e.collectionId+"/photos"};return{getPathname:t,handleRequest:g((function(r){var o=r.collectionId,u=r.orientation,i=n(r,["collectionId","orientation"]);return{pathname:t({collectionId:o}),query:a(e({},I(i),{orientation:u}))}})),handleResponse:q()}}(),_=function(){var e=function(e){return"/collections/"+e.collectionId};return{getPathname:e,handleRequest:g((function(n){return{pathname:e({collectionId:n.collectionId}),query:{}}})),handleResponse:f()}}(),b=function(){return{getPathname:function(){return"/collections"},handleRequest:g((function(e){return void 0===e&&(e={}),{pathname:"/collections",query:I(e)}})),handleResponse:q()}}(),k=function(){var e=function(e){return"/collections/"+e.collectionId+"/related"};return{getPathname:e,handleRequest:g((function(n){return{pathname:e({collectionId:n.collectionId}),query:{}}})),handleResponse:f()}}(),S={__proto__:null,getPhotos:w,get:_,list:b,getRelated:k},O=function(){return{getPathname:function(e){return"/photos"},handleRequest:g((function(e){return void 0===e&&(e={}),{pathname:"/photos",query:a(I(e))}})),handleResponse:q()}}(),j=function(){var e=function(e){return"/photos/"+e.photoId};return{getPathname:e,handleRequest:g((function(n){return{pathname:e({photoId:n.photoId}),query:{}}})),handleResponse:f()}}(),A=function(){var e=function(e){return"/photos/"+e.photoId+"/statistics"};return{getPathname:e,handleRequest:g((function(n){return{pathname:e({photoId:n.photoId}),query:{}}})),handleResponse:f()}}(),x=function(){return{getPathname:function(){return"/photos/random"},handleRequest:g((function(t){var r=void 0===t?{}:t,o=r.collectionIds,u=r.contentFilter,i=r.topicIds,s=n(r,["collectionIds","contentFilter","topicIds"]);return{pathname:"/photos/random",query:a(e({},s,{content_filter:u},R(o),P(i))),headers:{"cache-control":"no-cache"}}})),handleResponse:f()}}(),L={handleRequest:g((function(e){var n=function(e){var n=new URL(e),t=n.pathname;return{query:function(e){var n={};return e.forEach((function(e,t){n[t]=e})),n}(n.searchParams),pathname:"/"===t?void 0:t}}(e.downloadLocation),t=n.pathname,o=n.query;if(!r(t))throw new Error("Could not parse pathname from url.");return{pathname:t,query:a(o)}})),handleResponse:f()},C={__proto__:null,list:O,get:j,getStats:A,getRandom:x,trackDownload:L},T=function(){return{getPathname:function(e){return"/search/photos"},handleRequest:g((function(t){var r=t.query,o=t.page,u=t.perPage,i=t.orderBy,s=t.collectionIds,c=t.lang,l=t.contentFilter,h=n(t,["query","page","perPage","orderBy","collectionIds","lang","contentFilter"]);return{pathname:"/search/photos",query:a(e({query:r,content_filter:l,lang:c,order_by:i},I({page:o,perPage:u}),R(s),h))}})),handleResponse:f()}}(),z=function(){return{getPathname:function(e){return"/search/collections"},handleRequest:g((function(t){var r=t.query,o=n(t,["query"]);return{pathname:"/search/collections",query:e({query:r},I(o))}})),handleResponse:f()}}(),B=function(){return{getPathname:function(e){return"/search/users"},handleRequest:g((function(t){var r=t.query,o=n(t,["query"]);return{pathname:"/search/users",query:e({query:r},I(o))}})),handleResponse:f()}}(),E={__proto__:null,getPhotos:T,getCollections:z,getUsers:B},U=function(){var e=function(e){return"/users/"+e.username};return{getPathname:e,handleRequest:g((function(n){return{pathname:e({username:n.username}),query:{}}})),handleResponse:f()}}(),M=function(){var t=function(e){return"/users/"+e.username+"/photos"};return{getPathname:t,handleRequest:g((function(r){var o=r.username,u=r.stats,i=r.orientation,s=n(r,["username","stats","orientation"]);return{pathname:t({username:o}),query:a(e({},I(s),{orientation:i,stats:u}))}})),handleResponse:q()}}(),K=function(){var t=function(e){return"/users/"+e.username+"/likes"};return{getPathname:t,handleRequest:g((function(r){var o=r.username,u=r.orientation,i=n(r,["username","orientation"]);return{pathname:t({username:o}),query:a(e({},I(i),{orientation:u}))}})),handleResponse:q()}}(),D=function(){var e=function(e){return"/users/"+e.username+"/collections"};return{getPathname:e,handleRequest:g((function(t){var r=t.username,o=n(t,["username"]);return{pathname:e({username:r}),query:I(o)}})),handleResponse:q()}}(),F={__proto__:null,get:U,getPhotos:M,getLikes:K,getCollections:D},H=function(e){return"/topics/"+e.topicIdOrSlug},N=m({getPathname:H,handleRequest:function(n){var t=n.orderBy,r=n.topicIdsOrSlugs;return{pathname:"/topics",query:a(e({},I({page:n.page,perPage:n.perPage}),{ids:null==r?void 0:r.join(","),order_by:t}))}},handleResponse:q()}),G=m({getPathname:H,handleRequest:function(e){return{pathname:H({topicIdOrSlug:e.topicIdOrSlug}),query:{}}},handleResponse:f()}),V=function(){var t=u(H,(function(e){return e+"/photos"}));return{getPathname:t,handleRequest:function(r){var o=r.topicIdOrSlug,u=r.orientation,i=n(r,["topicIdOrSlug","orientation"]);return{pathname:t({topicIdOrSlug:o}),query:a(e({},I(i),{orientation:u}))}},handleResponse:q()}}(),J={__proto__:null,collections:S,photos:C,search:E,users:F,topics:{__proto__:null,list:N,get:G,getPhotos:V},trackNonHotLinkedPhotoView:function(e){var n=e.appId;return function(e){var t=e.photoId,r=Array.isArray(t)?t:[t];if(r.length>20)throw new Error("You cannot track more than 20 photos at once. Please try again with fewer photos.");return fetch("views.unsplash.com/v?photo_id="+r.join()+"&app_id="+n)}}};(i=exports.Language||(exports.Language={})).Afrikaans="af",i.Amharic="am",i.Arabic="ar",i.Azerbaijani="az",i.Belarusian="be",i.Bulgarian="bg",i.Bengali="bn",i.Bosnian="bs",i.Catalan="ca",i.Cebuano="ceb",i.Corsican="co",i.Czech="cs",i.Welsh="cy",i.Danish="da",i.German="de",i.Greek="el",i.English="en",i.Esperanto="eo",i.Spanish="es",i.Estonian="et",i.Basque="eu",i.Persian="fa",i.Finnish="fi",i.French="fr",i.Frisian="fy",i.Irish="ga",i.ScotsGaelic="gd",i.Galician="gl",i.Gujarati="gu",i.Hausa="ha",i.Hawaiian="haw",i.Hindi="hi",i.Hmong="hmn",i.Croatian="hr",i.HaitianCreole="ht",i.Hungarian="hu",i.Armenian="hy",i.Indonesian="id",i.Igbo="ig",i.Icelandic="is",i.Italian="it",i.Hebrew="iw",i.Japanese="ja",i.Javanese="jw",i.Georgian="ka",i.Kazakh="kk",i.Khmer="km",i.Kannada="kn",i.Korean="ko",i.Kurdish="ku",i.Kyrgyz="ky",i.Latin="la",i.Luxembourgish="lb",i.Lao="lo",i.Lithuanian="lt",i.Latvian="lv",i.Malagasy="mg",i.Maori="mi",i.Macedonian="mk",i.Malayalam="ml",i.Mongolian="mn",i.Marathi="mr",i.Malay="ms",i.Maltese="mt",i.Myanmar="my",i.Nepali="ne",i.Dutch="nl",i.Norwegian="no",i.Nyanja="ny",i.Oriya="or",i.Punjabi="pa",i.Polish="pl",i.Pashto="ps",i.Portuguese="pt",i.Romanian="ro",i.Russian="ru",i.Kinyarwanda="rw",i.Sindhi="sd",i.Sinhala="si",i.Slovak="sk",i.Slovenian="sl",i.Samoan="sm",i.Shona="sn",i.Somali="so",i.Albanian="sq",i.Serbian="sr",i.Sesotho="st",i.Sundanese="su",i.Swedish="sv",i.Swahili="sw",i.Tamil="ta",i.Telugu="te",i.Tajik="tg",i.Thai="th",i.Turkmen="tk",i.Filipino="tl",i.Turkish="tr",i.Tatar="tt",i.Uighur="ug",i.Ukrainian="uk",i.Urdu="ur",i.Uzbek="uz",i.Vietnamese="vi",i.Xhosa="xh",i.Yiddish="yi",i.Yoruba="yo",i.ChineseSimplified="zh",i.ChineseTraditional="zh-TW",i.Zulu="zu",(s=exports.OrderBy||(exports.OrderBy={})).LATEST="latest",s.POPULAR="popular",s.VIEWS="views",s.DOWNLOADS="downloads",s.OLDEST="oldest";var W=u(y,(function(e){return{photos:{get:e(j),list:e(O),getStats:e(A),getRandom:e(x),trackDownload:e(L)},users:{getPhotos:e(M),getCollections:e(D),getLikes:e(K),get:e(U)},search:{getCollections:e(z),getPhotos:e(T),getUsers:e(B)},collections:{getPhotos:e(w),get:e(_),list:e(b),getRelated:e(k)},topics:{list:e(N),get:e(G),getPhotos:e(V)}}}));exports._internals=J,exports.createApi=W;
//# sourceMappingURL=unsplash-js.cjs.production.min.js.map

@@ -1,3 +0,1 @@

import { parse } from 'content-type';
function _extends() {

@@ -112,8 +110,9 @@ _extends = Object.assign || function (target) {

var CONTENT_TYPE_RESPONSE_HEADER = 'content-type';
var CONTENT_TYPE_JSON = 'application/json';
var isJSON = function isJSON(contentType) {
return /application\/[^+]*[+]?(json);?.*/.test(contentType);
};
var checkIsJsonResponse = function checkIsJsonResponse(response) {
var contentTypeHeader = response.headers.get(CONTENT_TYPE_RESPONSE_HEADER);
return isDefined(contentTypeHeader) && parse(contentTypeHeader).type === CONTENT_TYPE_JSON;
var contentTypeHeader = response.headers.get('content-type');
return isDefined(contentTypeHeader) && isJSON(contentTypeHeader);
};

@@ -120,0 +119,0 @@ /**

{
"name": "unsplash-js",
"version": "7.0.18",
"version": "7.0.19",
"description": "Official JavaScript wrapper for the Unsplash API",

@@ -78,6 +78,3 @@ "main": "dist/index.js",

"homepage": "https://github.com/unsplash/unsplash-js#readme",
"dependencies": {
"@types/content-type": "^1.1.3",
"content-type": "^1.0.4"
}
"dependencies": {}
}

@@ -0,1 +1,3 @@

/* eslint-disable no-redeclare */
import { isDefined } from './typescript';

@@ -2,0 +4,0 @@

@@ -1,14 +0,12 @@

import * as ContentTypeHelpers from 'content-type';
import { DecodingError } from './errors';
import { AnyJson, isDefined } from './typescript';
const CONTENT_TYPE_RESPONSE_HEADER = 'content-type';
const CONTENT_TYPE_JSON = 'application/json';
const checkIsJsonResponse = (response: Response) => {
const contentTypeHeader = response.headers.get(CONTENT_TYPE_RESPONSE_HEADER);
// Regex from: https://stackoverflow.com/a/73613161
const isJSON = (contentType: string): boolean =>
/application\/[^+]*[+]?(json);?.*/.test(contentType);
return (
isDefined(contentTypeHeader) &&
ContentTypeHelpers.parse(contentTypeHeader).type === CONTENT_TYPE_JSON
);
const checkIsJsonResponse = (response: Response): boolean => {
const contentTypeHeader = response.headers.get('content-type');
return isDefined(contentTypeHeader) && isJSON(contentTypeHeader);
};

@@ -15,0 +13,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

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