Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101375576
index.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 9, 20:27
Size
1 KB
Mime Type
text/x-Algol68
Expires
Tue, Feb 11, 20:27 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24147421
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
index.js
View Options
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
noCase
=
void
0
;
var
lower_case_1
=
require
(
"lower-case"
);
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
var
DEFAULT_SPLIT_REGEXP
=
[
/([a-z0-9])([A-Z])/g
,
/([A-Z])([A-Z][a-z])/g
];
// Remove all non-word characters.
var
DEFAULT_STRIP_REGEXP
=
/[^A-Z0-9]+/gi
;
/**
* Normalize the string into something other libraries can manipulate easier.
*/
function
noCase
(
input
,
options
)
{
if
(
options
===
void
0
)
{
options
=
{};
}
var
_a
=
options
.
splitRegexp
,
splitRegexp
=
_a
===
void
0
?
DEFAULT_SPLIT_REGEXP
:
_a
,
_b
=
options
.
stripRegexp
,
stripRegexp
=
_b
===
void
0
?
DEFAULT_STRIP_REGEXP
:
_b
,
_c
=
options
.
transform
,
transform
=
_c
===
void
0
?
lower_case_1
.
lowerCase
:
_c
,
_d
=
options
.
delimiter
,
delimiter
=
_d
===
void
0
?
" "
:
_d
;
var
result
=
replace
(
replace
(
input
,
splitRegexp
,
"$1\0$2"
),
stripRegexp
,
"\0"
);
var
start
=
0
;
var
end
=
result
.
length
;
// Trim the delimiter from around the output string.
while
(
result
.
charAt
(
start
)
===
"\0"
)
start
++
;
while
(
result
.
charAt
(
end
-
1
)
===
"\0"
)
end
--
;
// Transform each token independently.
return
result
.
slice
(
start
,
end
).
split
(
"\0"
).
map
(
transform
).
join
(
delimiter
);
}
exports
.
noCase
=
noCase
;
/**
* Replace `re` in the input string with the replacement value.
*/
function
replace
(
input
,
re
,
value
)
{
if
(
re
instanceof
RegExp
)
return
input
.
replace
(
re
,
value
);
return
re
.
reduce
(
function
(
input
,
re
)
{
return
input
.
replace
(
re
,
value
);
},
input
);
}
//# sourceMappingURL=index.js.map
Event Timeline
Log In to Comment