@opensea/seadn
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -6,3 +6,3 @@ type MediaFormat = "webp" | "avif" | "jpeg" | "png"; | ||
format?: MediaFormat; | ||
quality?: number; | ||
quality?: number | `${number}`; | ||
}; | ||
@@ -9,0 +9,0 @@ declare function optimize(image: string | URL, { width, height, format, quality }: MediaParams): string; |
@@ -1,2 +0,2 @@ | ||
"use strict";var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})},m=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of d(t))!u.call(e,n)&&n!==r&&s(e,n,{get:()=>t[n],enumerable:!(i=f(t,n))||i.enumerable});return e};var b=e=>m(s({},"__esModule",{value:!0}),e);var w={};p(w,{canBeOptimized:()=>o,optimize:()=>c});module.exports=b(w);function c(e,{width:t,height:r,format:i,quality:n}){try{typeof e=="string"&&(e=new URL(e))}catch(l){return e.toString()}if(!(e instanceof URL))return e;if(!o(e))return e.toString();let a=new URLSearchParams;if(r!==void 0&&a.set("h",String(r)),t!==void 0&&a.set("w",String(t)),i!==void 0&&a.set("format",i),n){if(n<=0||n>100)throw new Error("Quality has to be a positive number between 1 and 100");a.set("q",String(n))}return e.search=a.toString(),e.toString()}function o(e){if(!h(e))return!1;let t=e.pathname.split(".");if(t.length<=1)return!0;switch(t[t.length-1]){case"png":case"jpeg":case"webp":case"avif":case"ico":case void 0:return!0;default:return!1}}function h(e){switch(e.hostname){case"i2.dev.seadn.io":case"i2c.dev.seadn.io":case"i2.seadn.io":case"i2c.seadn.io":return!0;default:return!1}}0&&(module.exports={canBeOptimized,optimize}); | ||
"use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})},m=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!d.call(e,n)&&n!==r&&s(e,n,{get:()=>t[n],enumerable:!(i=c(t,n))||i.enumerable});return e};var b=e=>m(s({},"__esModule",{value:!0}),e);var w={};p(w,{canBeOptimized:()=>o,optimize:()=>u});module.exports=b(w);function u(e,{width:t,height:r,format:i,quality:n}){try{typeof e=="string"&&(e=new URL(e))}catch(l){return e.toString()}if(!(e instanceof URL))return e;if(!o(e))return e.toString();let a=new URLSearchParams;if(r!==void 0&&a.set("h",String(r)),t!==void 0&&a.set("w",String(t)),i!==void 0&&a.set("format",i),n){if(Number(n)<=0||Number(n)>100)throw new Error("Quality has to be a positive number between 1 and 100");a.set("q",String(n))}return e.search=a.toString(),e.toString()}function o(e){if(!h(e))return!1;let t=e.pathname.split(".");if(t.length<=1)return!0;switch(t[t.length-1]){case"png":case"jpeg":case"webp":case"avif":case"ico":case void 0:return!0;default:return!1}}function h(e){switch(e.hostname){case"i2.dev.seadn.io":case"i2c.dev.seadn.io":case"i2.seadn.io":case"i2c.seadn.io":return!0;default:return!1}}0&&(module.exports={canBeOptimized,optimize}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@opensea/seadn", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Javascript SDK to work with SeaDN", | ||
@@ -22,7 +22,7 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "0.13.4", | ||
"@arethetypeswrong/cli": "0.13.6", | ||
"tsup": "8.0.1", | ||
"typescript": "5.3.3", | ||
"vitest": "1.1.0" | ||
"vitest": "1.2.2" | ||
} | ||
} |
@@ -7,3 +7,3 @@ export type MediaFormat = "webp" | "avif" | "jpeg" | "png"; | ||
format?: MediaFormat; | ||
quality?: number; | ||
quality?: number | `${number}`; | ||
}; | ||
@@ -42,3 +42,3 @@ | ||
if (quality) { | ||
if (quality <= 0 || quality > 100) { | ||
if (Number(quality) <= 0 || Number(quality) > 100) { | ||
throw new Error("Quality has to be a positive number between 1 and 100"); | ||
@@ -45,0 +45,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
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
14616