UNPKG
@liamcottle/push-receiver
Version:
latest (0.0.4)
0.0.4
0.0.3
0.0.2
0.0.1
A library to subscribe to GCM/FCM and receive notifications within a node process.
@liamcottle/push-receiver
/
src
/
utils
/
base64
/
index.js
16 lines
(13 loc)
•
236 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module
.
exports
= {
escape
, toBase64, };
function
escape
(
string
) {
return
string .
replace
(
/=/g
,
''
) .
replace
(
/\+/g
,
'-'
) .
replace
(
/\//g
,
'_'
); }
function
toBase64
(
input
) {
return
escape
(input.
toString
(
'base64'
)); }