Skip to content

Commit e894e5c

Browse files
author
Maya Shavin
committed
refactor: re arrange folder
1 parent eef1514 commit e894e5c

File tree

5 files changed

+19
-137
lines changed

5 files changed

+19
-137
lines changed

packages/url/__tests__/url.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ describe('Url', () => {
174174
aspectRatio: '16:9',
175175
},
176176
chaining: [{
177-
effect: 'grayscale'
177+
effect: {
178+
name: 'grayscale'
179+
},
178180
}]
179181
})).toBe('https://res.cloudinary.com/demo/image/upload/c_scale,w_500,h_500,ar_16:9,q_auto,f_auto/e_grayscale/example')
180182
})
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { toString } from '../lib/utils'
2+
3+
describe('Utils', () => {
4+
describe('toString()', () => {
5+
it('should returns array without any falsy value', () => {
6+
expect(toString([null, '', false, true, 'hello'])).toBe('true:hello')
7+
});
8+
9+
it('should returns string with given separation', () => {
10+
expect(toString(['hello', 'yeah'], '&')).toBe('hello&yeah')
11+
});
12+
});
13+
});

packages/url/lib/constants.ts

Lines changed: 0 additions & 130 deletions
This file was deleted.

packages/url/lib/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,9 @@ const Transformer:TransformerType = { transform, toString: toTransformationStr }
4343

4444
export { RESOURCE_TYPES, extractPublicId, STORAGE_TYPES, ROTATION_MODES, Transformer }
4545

46-
export type { CldOptions, TransformerOption, TransformerVideoOption, CloudConfig, Rotation } from './types/CldOptions'
46+
export type { CldOptions, TransformerOption, TransformerVideoOption, CloudConfig } from './types/CldOptions'
47+
export type { Resize, ResizeType, Border, CustomFunction, Position, Effect, Rotation, Flag, Offset, Radius, Gravity } from './types/transformation'
4748
export type { ResourceType } from './types/ResourceType'
4849
export type { StorageType } from './types/StorageType'
49-
export type { ResizeType, Resize } from './transformers/resize'
50-
export type { Border } from './transformers/border'
51-
export type { CustomFunction } from './transformers/customFunc'
52-
export type { Position } from './transformers/position'
53-
export type { Effect } from './transformers/effect'
5450

5551
export default buildUrl

packages/url/lib/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const toString = (arr:any[], separation:string = ':') => arr.filter(Boolean).join(separation)

0 commit comments

Comments
 (0)