-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
74 lines (70 loc) · 1.51 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* @poppinss/string
*
* (c) Poppinss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import bytes from './src/bytes.js'
import seconds from './src/seconds.js'
import { slug } from './src/slugify.js'
import { random } from './src/random.js'
import { excerpt } from './src/excerpt.js'
import { justify } from './src/justify.js'
import { ordinal } from './src/ordinal.js'
import { truncate } from './src/truncate.js'
import { sentence } from './src/sentence.js'
import { wordWrap } from './src/word_wrap.js'
import milliseconds from './src/milliseconds.js'
import { htmlEscape } from './src/html_escape.js'
import { interpolate } from './src/interpolate.js'
import { plural, pluralize, singular, isPlural, isSingular } from './src/pluralize.js'
import {
noCase,
dotCase,
dashCase,
camelCase,
snakeCase,
titleCase,
pascalCase,
capitalCase,
sentenceCase,
} from './src/change_case.js'
/**
* Condense multiple whitespaces from a string
*/
function condenseWhitespace(value: string): string {
return value.trim().replace(/\s{2,}/g, ' ')
}
const string = {
excerpt,
truncate,
slug,
interpolate,
plural,
pluralize,
singular,
isPlural,
isSingular,
camelCase,
capitalCase,
dashCase,
dotCase,
noCase,
pascalCase,
sentenceCase,
snakeCase,
titleCase,
random,
sentence,
condenseWhitespace,
wordWrap,
seconds,
milliseconds,
bytes,
ordinal,
htmlEscape,
justify,
}
export default string