-
Notifications
You must be signed in to change notification settings - Fork 16
/
sindresorhus_slugify.node.txt
70 lines (52 loc) · 4.25 KB
/
sindresorhus_slugify.node.txt
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
SLUGIFY
ALTERNATIVES ==> #See simov slugify
VERSION ==> #2.2.0
/=+===============================+=\
/ : : \
)==: MAIN :==(
\ :_______________________________: /
\=+===============================+=/
SLUGIFY(STR[, OPTS])->STR #Transform a string to dasherized lowercase with only [a-z0-9]
#Does:
# - dasherize lowercase: AbcDef -> abc-def, Abc Def -> abc-def
# - replace anything that is not [a-z0-9] by -
# - squash multiple separators into single ones
# - use TRANSLITERATE()
OPTS.decamelize #BOOL (def: true)
OPTS.lowercase #BOOL (def: true)
OPTS.separator #STR (def: '-')
OPTS.customReplacements #[STR, STR2]_ARR (def: [['&', 'and']])
#Replace each STR by STR2
OPTS.preserveLeadingUnderscore #BOOL. If false (def), remove initial _
OPTS.preserveTrailingDash #BOOL. If false (def), remove trailing -
OPTS.preserveCharacters #'CHAR'_ARR (def: []) to not remove
slugifyWithCounter()->SLUGIFY #Append -NUM to duplicate return values
SLUGIFY.reset() #
/=+===============================+=\
/ : : \
)==: CLI :==(
\ :_______________________________: /
\=+===============================+=/
slugify STR #CLI
#Version 3.0.0
--no-decamelize #
--no-lowercase #
--separator=STR #
--preserve-leading-underscore #
/=+===============================+=\
/ : : \
)==: TRANSLITERATE :==(
\ :_______________________________: /
\=+===============================+=/
TRANSLITERATE(STR[, OPTS])->STR #Replace some Unicode chars by ASCII, e.g.:
# - à -> a
# - ç -> c
# - ü -> ue
# - ß -> ss
# - 𝑲 -> k
# - greek|cyrillic|arabic|vietnamese|..., currencies -> latin alphabet
#Also calls STR.normalize()
#Version 1.6.0
OPTS.customReplacements #[STR, STR2]_ARR. Replace each STR by STR2