@tempots/std 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arrays.d.ts +49 -0
- package/arrays.js +249 -0
- package/async-result.d.ts +37 -0
- package/async-result.js +75 -0
- package/bigint.d.ts +18 -0
- package/bigint.js +110 -0
- package/booleans.d.ts +23 -0
- package/{src/booleans.ts → booleans.js} +33 -38
- package/colors/cmyk.d.ts +21 -0
- package/colors/cmyk.js +54 -0
- package/colors/convert.d.ts +283 -0
- package/colors/convert.js +742 -0
- package/colors/hsl.d.ts +24 -0
- package/colors/hsl.js +56 -0
- package/colors/hsla.d.ts +18 -0
- package/colors/hsla.js +35 -0
- package/colors/hsluv.d.ts +24 -0
- package/colors/hsluv.js +56 -0
- package/colors/hsv.d.ts +24 -0
- package/colors/hsv.js +54 -0
- package/colors/lab.d.ts +24 -0
- package/colors/lab.js +54 -0
- package/colors/lch.d.ts +19 -0
- package/colors/lch.js +44 -0
- package/colors/luv.d.ts +19 -0
- package/colors/luv.js +45 -0
- package/colors/rgb.d.ts +13 -0
- package/colors/rgb.js +47 -0
- package/colors/rgba.d.ts +12 -0
- package/colors/rgba.js +44 -0
- package/colors/srgb.d.ts +24 -0
- package/colors/srgb.js +51 -0
- package/colors/xyz.d.ts +19 -0
- package/colors/xyz.js +41 -0
- package/edit.d.ts +20 -0
- package/edit.js +29 -0
- package/equals.d.ts +3 -0
- package/equals.js +122 -0
- package/functions.d.ts +20 -0
- package/functions.js +38 -0
- package/json.d.ts +14 -0
- package/json.js +33 -0
- package/match.d.ts +16 -0
- package/match.js +45 -0
- package/maybe.d.ts +9 -0
- package/{src/maybe.ts → maybe.js} +11 -18
- package/memoize.d.ts +1 -0
- package/memoize.js +9 -0
- package/newtype.d.ts +28 -0
- package/newtype.js +29 -0
- package/numbers.d.ts +104 -0
- package/numbers.js +183 -0
- package/objects.d.ts +9 -0
- package/objects.js +33 -0
- package/ord.d.ts +19 -0
- package/ord.js +73 -0
- package/package.json +2 -2
- package/reg-exps.d.ts +10 -0
- package/{src/reg-exps.ts → reg-exps.js} +19 -24
- package/result.d.ts +31 -0
- package/result.js +95 -0
- package/strings.d.ts +314 -0
- package/strings.js +685 -0
- package/types/assert.d.ts +12 -0
- package/types/assert.js +13 -0
- package/types/differentiate.d.ts +13 -0
- package/types/differentiate.js +14 -0
- package/types/functions.d.ts +22 -0
- package/types/functions.js +13 -0
- package/types/generic.d.ts +9 -0
- package/types/generic.js +13 -0
- package/types/objects.d.ts +50 -0
- package/types/objects.js +13 -0
- package/types/tuples.d.ts +44 -0
- package/types/tuples.js +24 -0
- package/{src/types/utility.ts → types/utility.d.ts} +2 -3
- package/types/utility.js +1 -0
- package/uuid.d.ts +13 -0
- package/uuid.js +56 -0
- package/validation.d.ts +23 -0
- package/validation.js +44 -0
- package/src/arrays.ts +0 -296
- package/src/async-result.ts +0 -103
- package/src/bigint.ts +0 -111
- package/src/colors/cmyk.ts +0 -84
- package/src/colors/convert.ts +0 -1093
- package/src/colors/hsl.ts +0 -73
- package/src/colors/hsla.ts +0 -45
- package/src/colors/hsluv.ts +0 -73
- package/src/colors/hsv.ts +0 -75
- package/src/colors/lab.ts +0 -69
- package/src/colors/lch.ts +0 -53
- package/src/colors/luv.ts +0 -56
- package/src/colors/rgb.ts +0 -55
- package/src/colors/rgba.ts +0 -53
- package/src/colors/srgb.ts +0 -72
- package/src/colors/xyz.ts +0 -52
- package/src/edit.ts +0 -29
- package/src/equals.ts +0 -116
- package/src/functions.ts +0 -108
- package/src/json.ts +0 -52
- package/src/match.ts +0 -88
- package/src/memoize.ts +0 -9
- package/src/newtype.ts +0 -59
- package/src/numbers.ts +0 -222
- package/src/objects.ts +0 -47
- package/src/ord.ts +0 -79
- package/src/result.ts +0 -140
- package/src/strings.ts +0 -768
- package/src/types/assert.ts +0 -96
- package/src/types/differentiate.ts +0 -89
- package/src/types/functions.ts +0 -114
- package/src/types/generic.ts +0 -42
- package/src/types/objects.ts +0 -212
- package/src/types/tuples.ts +0 -244
- package/src/uuid.ts +0 -61
- package/src/validation.ts +0 -69
- package/test/arrays.spec.ts +0 -410
- package/test/colors.spec.ts +0 -406
- package/test/commmon.ts +0 -9
- package/test/equals.spec.ts +0 -165
- package/test/functions.spec.ts +0 -9
- package/test/index.d.ts +0 -20
- package/test/objects.spec.ts +0 -22
- package/test/reg-exps.spec.ts +0 -33
- package/test/strings.spec.ts +0 -333
- package/test/uuid.spec.ts +0 -35
- package/tsconfig.json +0 -19
package/test/strings.spec.ts
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2019 Google LLC
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software
|
|
8
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
-
See the License for the specific language governing permissions and
|
|
11
|
-
limitations under the License.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { describe, expect, test } from 'vitest'
|
|
15
|
-
import { Ordering } from '../src/ord'
|
|
16
|
-
import {
|
|
17
|
-
lowerCaseFirst,
|
|
18
|
-
upperCaseFirst,
|
|
19
|
-
contains,
|
|
20
|
-
count,
|
|
21
|
-
containsAny,
|
|
22
|
-
containsAll,
|
|
23
|
-
hashCode,
|
|
24
|
-
capitalizeWords,
|
|
25
|
-
diffIndex,
|
|
26
|
-
ellipsis,
|
|
27
|
-
ellipsisMiddle,
|
|
28
|
-
isAlphaNum,
|
|
29
|
-
humanize,
|
|
30
|
-
wrapColumns,
|
|
31
|
-
repeat,
|
|
32
|
-
upTo,
|
|
33
|
-
from,
|
|
34
|
-
after,
|
|
35
|
-
stripTags,
|
|
36
|
-
trimCharsLeft,
|
|
37
|
-
trimCharsRight,
|
|
38
|
-
trimChars,
|
|
39
|
-
toArray,
|
|
40
|
-
toLines,
|
|
41
|
-
order,
|
|
42
|
-
reverse
|
|
43
|
-
} from '../src/strings'
|
|
44
|
-
|
|
45
|
-
describe('strings.ts', () => {
|
|
46
|
-
test('LowerUpperCaseFirst', () => {
|
|
47
|
-
expect('aBC').toBe(lowerCaseFirst('ABC'))
|
|
48
|
-
expect('Abc').toBe(upperCaseFirst('abc'))
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
test('Contains', () => {
|
|
52
|
-
expect(contains('test', '')).toBe(true)
|
|
53
|
-
expect(contains('test', 't')).toBe(true)
|
|
54
|
-
expect(contains('test', 'te')).toBe(true)
|
|
55
|
-
expect(contains('test', 'tes')).toBe(true)
|
|
56
|
-
expect(contains('test', 'test')).toBe(true)
|
|
57
|
-
expect(contains('one two three', 'one')).toBe(true)
|
|
58
|
-
expect(contains('one two three', 'two')).toBe(true)
|
|
59
|
-
expect(contains('one two three', 'three')).toBe(true)
|
|
60
|
-
expect(contains('test', 'test ')).toBe(false)
|
|
61
|
-
expect(contains('test', ' test')).toBe(false)
|
|
62
|
-
expect(contains('test', 'tes ')).toBe(false)
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
test('Count', () => {
|
|
66
|
-
expect(3).toBe(
|
|
67
|
-
count('one two three four five six seven eight nine ten', 'o')
|
|
68
|
-
)
|
|
69
|
-
expect(2).toBe(
|
|
70
|
-
count('one two three four five six seven eight nine ten', 'en')
|
|
71
|
-
)
|
|
72
|
-
expect(3).toBe(
|
|
73
|
-
count('one two three four five six seven eight nine ten', ' t')
|
|
74
|
-
)
|
|
75
|
-
expect(2).toBe(
|
|
76
|
-
count('one two three four five six seven eight nine ten', 've')
|
|
77
|
-
)
|
|
78
|
-
expect(0).toBe(count('xxxxxx', 'y'))
|
|
79
|
-
expect(6).toBe(count('xxxxxx', 'x'))
|
|
80
|
-
expect(3).toBe(count('xxxxxx', 'xx'))
|
|
81
|
-
expect(2).toBe(count('xxxxxx', 'xxx'))
|
|
82
|
-
expect(1).toBe(count('xxxxxx', 'xxxx'))
|
|
83
|
-
expect(0).toBe(count('x', 'xx'))
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
test('ContainsAny', () => {
|
|
87
|
-
expect(containsAny('test', ['t', 'x', 'y'])).toBe(true)
|
|
88
|
-
expect(containsAny('test', ['e', 'x', 'y'])).toBe(true)
|
|
89
|
-
expect(containsAny('test', ['s', 'x', 'y'])).toBe(true)
|
|
90
|
-
expect(containsAny('test', ['x', 't', 'y'])).toBe(true)
|
|
91
|
-
expect(containsAny('test', ['x', 'e', 'y'])).toBe(true)
|
|
92
|
-
expect(containsAny('test', ['x', 's', 'y'])).toBe(true)
|
|
93
|
-
expect(containsAny('test', ['x', 'y', 't'])).toBe(true)
|
|
94
|
-
expect(containsAny('test', ['x', 'y', 'e'])).toBe(true)
|
|
95
|
-
expect(containsAny('test', ['x', 'y', 's'])).toBe(true)
|
|
96
|
-
expect(containsAny('one two three', ['zero', 'one', 'two'])).toBe(true)
|
|
97
|
-
expect(containsAny('one two three', ['one', 'two', 'three'])).toBe(true)
|
|
98
|
-
expect(containsAny('one two three', ['one two', 'x', 'three'])).toBe(true)
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
test('ContainsAll', () => {
|
|
102
|
-
expect(containsAll('test', ['t', 's', 'e'])).toBe(true)
|
|
103
|
-
expect(containsAll('test', ['e', 'x', 'y'])).toBe(false)
|
|
104
|
-
expect(containsAll('test', ['t'])).toBe(true)
|
|
105
|
-
expect(containsAll('test', ['e'])).toBe(true)
|
|
106
|
-
expect(containsAll('test', ['s', 't'])).toBe(true)
|
|
107
|
-
expect(containsAll('test', ['x', 't'])).toBe(false)
|
|
108
|
-
expect(containsAll('one two three', ['zero', 'one', 'two'])).toBe(false)
|
|
109
|
-
expect(containsAll('one two three', ['one', 'two', 'three'])).toBe(true)
|
|
110
|
-
expect(containsAll('one two three', ['one two', 'three'])).toBe(true)
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
test('HashCode', () => {
|
|
114
|
-
expect(hashCode('a')).toBe(3826002220)
|
|
115
|
-
expect(hashCode('abc')).toBe(440920331)
|
|
116
|
-
expect(hashCode('abcdefghijklm')).toBe(998463208)
|
|
117
|
-
expect(hashCode('abcdefghijklM')).toBe(461579400)
|
|
118
|
-
expect(hashCode('Abcdefghijklm')).toBe(3054447752)
|
|
119
|
-
expect(
|
|
120
|
-
hashCode(
|
|
121
|
-
'abcdefghijklmabcdefghijklmabcdefghijklmabcdefghijklmabcdefghijklm!!'
|
|
122
|
-
)
|
|
123
|
-
).toBe(3846459698)
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
test('Ucwordsws', () => {
|
|
127
|
-
const tests = [
|
|
128
|
-
{ expected: 'Test', test: 'test' },
|
|
129
|
-
{ expected: 'Test Test', test: 'test test' },
|
|
130
|
-
{ expected: ' Test Test Test ', test: ' test test test ' },
|
|
131
|
-
{ expected: 'Test\nTest', test: 'test\ntest' },
|
|
132
|
-
{ expected: 'Test\tTest', test: 'test\ttest' }
|
|
133
|
-
]
|
|
134
|
-
for (const item of tests) { expect(capitalizeWords(item.test, true)).toBe(item.expected) }
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
test('diffIndex', () => {
|
|
138
|
-
expect(3).toBe(diffIndex('abcdef', 'abc123'))
|
|
139
|
-
expect(0).toBe(diffIndex('', 'abc123'))
|
|
140
|
-
expect(1).toBe(diffIndex('a', 'abc123'))
|
|
141
|
-
expect(0).toBe(diffIndex('abc123', ''))
|
|
142
|
-
expect(1).toBe(diffIndex('abc123', 'a'))
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
test('Ellipsis', () => {
|
|
146
|
-
const test = 'abcdefghijkl'
|
|
147
|
-
const tests = [
|
|
148
|
-
{ expected: 'abcdefghijkl', len: undefined, symbol: undefined },
|
|
149
|
-
{ expected: 'abcdefghijkl', len: 100, symbol: undefined },
|
|
150
|
-
{ expected: 'abcd…', len: 5, symbol: undefined },
|
|
151
|
-
{ expected: 'a ...', len: 5, symbol: ' ...' },
|
|
152
|
-
{ expected: '..', len: 2, symbol: ' ...' },
|
|
153
|
-
{ expected: 'abcdef ...', len: 10, symbol: ' ...' }
|
|
154
|
-
]
|
|
155
|
-
for (const item of tests) { expect(item.expected).toBe(ellipsis(test, item.len, item.symbol)) }
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
test('EllipsisMiddle', () => {
|
|
159
|
-
const test = 'abcdefghijkl'
|
|
160
|
-
const tests = [
|
|
161
|
-
{ expected: 'abcdefghijkl', len: undefined, symbol: undefined },
|
|
162
|
-
{ expected: 'abcdefghijkl', len: 100, symbol: undefined },
|
|
163
|
-
{ expected: 'ab…kl', len: 5, symbol: undefined },
|
|
164
|
-
{ expected: 'a ...', len: 5, symbol: ' ...' },
|
|
165
|
-
{ expected: '..', len: 2, symbol: ' ...' },
|
|
166
|
-
{ expected: 'abc ...jkl', len: 10, symbol: ' ...' }
|
|
167
|
-
]
|
|
168
|
-
for (const item of tests) { expect(item.expected).toBe(ellipsisMiddle(test, item.len, item.symbol)) }
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
test('Ucwords', () => {
|
|
172
|
-
const tests = [
|
|
173
|
-
{ expected: 'Test', test: 'test' },
|
|
174
|
-
{ expected: 'Test Test', test: 'test test' },
|
|
175
|
-
{
|
|
176
|
-
expected: ' Test-Test:Test_Test : Test ',
|
|
177
|
-
test: ' test-test:test_test : test '
|
|
178
|
-
},
|
|
179
|
-
{ expected: 'Test\nTest', test: 'test\ntest' },
|
|
180
|
-
{ expected: 'Test\tTest', test: 'test\ttest' }
|
|
181
|
-
]
|
|
182
|
-
for (const item of tests) { expect(capitalizeWords(item.test)).toBe(item.expected) }
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
test('AlphaNum', () => {
|
|
186
|
-
const tests = [
|
|
187
|
-
{ expected: true, test: 'a' },
|
|
188
|
-
{ expected: true, test: '1a' },
|
|
189
|
-
{ expected: false, test: ' a' },
|
|
190
|
-
{ expected: false, test: ' ' },
|
|
191
|
-
{ expected: false, test: '' }
|
|
192
|
-
]
|
|
193
|
-
for (const item of tests) expect(item.expected).toBe(isAlphaNum(item.test))
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
test('Humanize', () => {
|
|
197
|
-
expect(humanize('helloWorld')).toBe('hello world')
|
|
198
|
-
expect(humanize('my_long_string')).toBe('my long string')
|
|
199
|
-
expect(humanize('ignoreMANY')).toBe('ignore many')
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
test('WrapColumn', () => {
|
|
203
|
-
const text =
|
|
204
|
-
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'
|
|
205
|
-
|
|
206
|
-
expect(
|
|
207
|
-
`Lorem ipsum dolor
|
|
208
|
-
sit amet,
|
|
209
|
-
consectetur
|
|
210
|
-
adipisicing elit,
|
|
211
|
-
sed do eiusmod
|
|
212
|
-
tempor incididunt ut
|
|
213
|
-
labore et dolore
|
|
214
|
-
magna aliqua. Ut
|
|
215
|
-
enim ad minim
|
|
216
|
-
veniam, quis nostrud
|
|
217
|
-
exercitation ullamco
|
|
218
|
-
laboris nisi ut
|
|
219
|
-
aliquip ex ea
|
|
220
|
-
commodo consequat.`
|
|
221
|
-
).toBe(wrapColumns(text, 20))
|
|
222
|
-
|
|
223
|
-
expect(
|
|
224
|
-
` Lorem ipsum
|
|
225
|
-
dolor sit amet,
|
|
226
|
-
consectetur
|
|
227
|
-
adipisicing
|
|
228
|
-
elit, sed do
|
|
229
|
-
eiusmod tempor
|
|
230
|
-
incididunt ut
|
|
231
|
-
labore et dolore
|
|
232
|
-
magna aliqua. Ut
|
|
233
|
-
enim ad minim
|
|
234
|
-
veniam, quis
|
|
235
|
-
nostrud
|
|
236
|
-
exercitation
|
|
237
|
-
ullamco laboris
|
|
238
|
-
nisi ut aliquip
|
|
239
|
-
ex ea commodo
|
|
240
|
-
consequat.`
|
|
241
|
-
).toBe(wrapColumns(text, 20, ' '))
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
test('WrapColumnPreserveNewLines', () => {
|
|
245
|
-
const text = 'Lorem ipsum dolor sit amet,\n\nconsectetur adipisicing elit'
|
|
246
|
-
expect(
|
|
247
|
-
'Lorem ipsum dolor\nsit amet,\n\nconsectetur\nadipisicing elit'
|
|
248
|
-
).toBe(wrapColumns(text, 18))
|
|
249
|
-
})
|
|
250
|
-
|
|
251
|
-
test('WrapColumnLong', () => {
|
|
252
|
-
const text = 'aaaaaaaaaa aaaa aaa aa'
|
|
253
|
-
expect(
|
|
254
|
-
`aaaaaaaaaa
|
|
255
|
-
aaaa
|
|
256
|
-
aaa aa`
|
|
257
|
-
).toBe(wrapColumns(text, 6))
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
test('Repeat', () => {
|
|
261
|
-
expect('XyXyXy').toBe(repeat('Xy', 3))
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
test('UpTo', () => {
|
|
265
|
-
expect('abcdef').toBe(upTo('abcdef', 'x'))
|
|
266
|
-
expect('ab').toBe(upTo('abcdef', 'cd'))
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
test('From', () => {
|
|
270
|
-
expect('').toBe(from('abcdef', 'x'))
|
|
271
|
-
expect('cdef').toBe(from('abcdef', 'cd'))
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
test('After', () => {
|
|
275
|
-
expect('').toBe(after('abcdef', 'x'))
|
|
276
|
-
expect('ef').toBe(after('abcdef', 'cd'))
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
test('StripTags', () => {
|
|
280
|
-
expect('a code; x').toBe(
|
|
281
|
-
stripTags('a<br/> <script src="aaa">code;</script> x')
|
|
282
|
-
)
|
|
283
|
-
})
|
|
284
|
-
|
|
285
|
-
test('Ltrim', () => {
|
|
286
|
-
expect('abcde').toBe(trimCharsLeft('abcde', 'x'))
|
|
287
|
-
expect('de').toBe(trimCharsLeft('abcde', 'cba'))
|
|
288
|
-
expect('abcde').toBe(trimCharsLeft('abcde', 'b'))
|
|
289
|
-
|
|
290
|
-
expect('').toBe(trimCharsLeft('/', '/'))
|
|
291
|
-
})
|
|
292
|
-
|
|
293
|
-
test('Rtrim', () => {
|
|
294
|
-
expect('abcde').toBe(trimCharsRight('abcde', 'x'))
|
|
295
|
-
expect('ab').toBe(trimCharsRight('abcde', 'ced'))
|
|
296
|
-
expect('abcde').toBe(trimCharsRight('abcde', 'd'))
|
|
297
|
-
|
|
298
|
-
expect('').toBe(trimCharsRight('/', '/'))
|
|
299
|
-
})
|
|
300
|
-
|
|
301
|
-
test('Trim', () => {
|
|
302
|
-
expect('abcde').toBe(trimChars('abcde', 'x'))
|
|
303
|
-
expect('cd').toBe(trimChars('abcde', 'abe'))
|
|
304
|
-
expect('abcde').toBe(trimChars('abcde', 'bd'))
|
|
305
|
-
|
|
306
|
-
expect('').toBe(trimChars('/', '/'))
|
|
307
|
-
})
|
|
308
|
-
|
|
309
|
-
test('ToArray', () => {
|
|
310
|
-
const t = 'a☺b☺☺c☺☺☺'
|
|
311
|
-
const e = ['a', '☺', 'b', '☺', '☺', 'c', '☺', '☺', '☺']
|
|
312
|
-
expect(e).toEqual(toArray(t))
|
|
313
|
-
})
|
|
314
|
-
|
|
315
|
-
test('ToLines', () => {
|
|
316
|
-
const text = `Split
|
|
317
|
-
to
|
|
318
|
-
lines`
|
|
319
|
-
expect(['Split', 'to', 'lines']).toEqual(toLines(text))
|
|
320
|
-
})
|
|
321
|
-
|
|
322
|
-
test('Reverse', () => {
|
|
323
|
-
const t = 'a☺b☺☺c☺☺☺'
|
|
324
|
-
const e = '☺☺☺c☺☺b☺a'
|
|
325
|
-
expect(e).toEqual(reverse(t))
|
|
326
|
-
})
|
|
327
|
-
|
|
328
|
-
test('Order', () => {
|
|
329
|
-
expect(Ordering.EQ).toBe(order.compare('companyId', 'companyId'))
|
|
330
|
-
expect(Ordering.LT).toBe(order.compare('companyIc', 'companyId'))
|
|
331
|
-
expect(Ordering.GT).toBe(order.compare('companyId', 'companyIc'))
|
|
332
|
-
})
|
|
333
|
-
})
|
package/test/uuid.spec.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2019 Google LLC
|
|
3
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License.
|
|
5
|
-
You may obtain a copy of the License at
|
|
6
|
-
https://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software
|
|
8
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10
|
-
See the License for the specific language governing permissions and
|
|
11
|
-
limitations under the License.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { describe, expect, test } from 'vitest'
|
|
15
|
-
import { create, UUID } from '../src/uuid'
|
|
16
|
-
|
|
17
|
-
describe('UUID', () => {
|
|
18
|
-
test('validate random created UUIDS', () => {
|
|
19
|
-
for (let i = 0; i < 1000; i++) {
|
|
20
|
-
expect(UUID.isValid(UUID.get(create()))).toBe(true)
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
test('validate random created UUIDS', () => {
|
|
25
|
-
expect(UUID.isValid('43f0a658-70ee-4ab8-8c6d-7f959141115e')).toBe(true)
|
|
26
|
-
|
|
27
|
-
expect(UUID.isValid('some-value')).toBe(false)
|
|
28
|
-
expect(UUID.isValid('-6b909adc-d628-411a-8894-16cfdd296073')).toBe(false)
|
|
29
|
-
expect(UUID.isValid('6b909adc-d628-411a-8894-16cfdd296073-')).toBe(false)
|
|
30
|
-
expect(UUID.isValid('a6b909adc-d628-411a-8894-16cfdd296073')).toBe(false)
|
|
31
|
-
expect(UUID.isValid('6b909adc-d628-411a-8894-16cfdd2960732')).toBe(false)
|
|
32
|
-
expect(UUID.isValid('aaaaaaaa-0000-3333-8888-1111111111111')).toBe(false)
|
|
33
|
-
expect(UUID.isValid('aaaaaaaa-0000-4333-1888-1111111111111')).toBe(false)
|
|
34
|
-
})
|
|
35
|
-
})
|
package/tsconfig.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"rootDir": "src",
|
|
4
|
-
"outDir": "dist",
|
|
5
|
-
"target": "ESNext",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"useDefineForClassFields": true,
|
|
8
|
-
"module": "ESNext",
|
|
9
|
-
"lib": ["ESNext", "DOM"],
|
|
10
|
-
"moduleResolution": "Node",
|
|
11
|
-
"strict": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"isolatedModules": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"noImplicitReturns": true,
|
|
16
|
-
"skipLibCheck": true
|
|
17
|
-
},
|
|
18
|
-
"include": ["src/**/*"]
|
|
19
|
-
}
|