File tree Expand file tree Collapse file tree 3 files changed +1029
-12
lines changed Expand file tree Collapse file tree 3 files changed +1029
-12
lines changed Original file line number Diff line number Diff line change 4
4
"description" : " Simple utility to generate blurhash from Image URL" ,
5
5
"main" : " dist/cjs/index.js" ,
6
6
"module" : " dist/esm/index.esm.js" ,
7
+ "umd" : " dist/umd/index.js" ,
7
8
"files" : [
8
9
" dist"
9
10
],
10
11
"types" : " dist/index.d.ts" ,
11
12
"scripts" : {
12
13
"build" : " rollup -c" ,
13
14
"test" : " yarn build && node ./test/index.js" ,
14
- "watch" : " rollup -cw"
15
+ "watch" : " rollup -cw" ,
16
+ "commit" : " gacp" ,
17
+ "clean:dist" : " npm exec -- rimraf ./dist"
15
18
},
16
19
"license" : " MIT" ,
17
20
"dependencies" : {
21
24
},
22
25
"devDependencies" : {
23
26
"@types/sharp" : " ^0.30.5" ,
27
+ "gacp" : " ^3.0.3" ,
28
+ "rimraf" : " ^3.0.2" ,
24
29
"rollup" : " ^2.78.1" ,
25
30
"rollup-plugin-typescript2" : " ^0.33.0" ,
26
31
"typescript" : " ^4.8.2"
44
49
" sharp" ,
45
50
" plaiceholder" ,
46
51
" blurhash-from-url"
47
- ]
52
+ ],
53
+ "gacp" : {
54
+ "add" : false ,
55
+ "push" : false ,
56
+ "emoji" : " emoji" ,
57
+ "editor" : false
58
+ }
48
59
}
Original file line number Diff line number Diff line change @@ -2,6 +2,13 @@ import get from "axios";
2
2
import { encode , decode } from "blurhash" ;
3
3
import sharp from 'sharp' ;
4
4
5
+ export interface IOutput {
6
+ encoded : string ;
7
+ decoded : Uint8ClampedArray ;
8
+ width : number ;
9
+ height : number ;
10
+ }
11
+
5
12
export const blurhashFromURL = async ( url : string ) => {
6
13
const image = await get ( url , {
7
14
responseType : "arraybuffer" ,
@@ -23,7 +30,7 @@ export const blurhashFromURL = async (url: string) => {
23
30
) ;
24
31
const decoded = decode ( encoded , info . width , info . height ) ;
25
32
26
- const output = {
33
+ const output : IOutput = {
27
34
encoded : encoded ,
28
35
decoded : decoded ,
29
36
width : info . width ,
You can’t perform that action at this time.
0 commit comments