UNPKG
@mattstyles/alias
Version:
latest (1.0.0)
1.0.0
The amazing string mutator
github.com/mattstyles/alias
mattstyles/alias
@mattstyles/alias
/
index.js
15 lines
(11 loc)
•
261 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module
.
exports
=
function
dict
(
dictionary
) {
if
( !dictionary ) {
throw
new
Error
(
'No list of terms passed to alias'
) }
return
function
alias
(
term
) {
if
( dictionary[ term ] ) {
return
dictionary[ term ] }
return
term } }