Skip to content

Commit b4e8ea4

Browse files
committed
check node_env before export
1 parent a14b0e2 commit b4e8ea4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/scripts/util.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import createUUID from 'uuid';
22

3-
let assetRoot = '/assets';
3+
export const uuid =
4+
process.env.NODE_ENV === 'test' ?
5+
() => '$uuid$' :
6+
createUUID;
47

5-
export function uuid() {
6-
return process.env.NODE_ENV === 'test' ? '$uuid$' : createUUID();
7-
}
8+
export const getToday =
9+
process.env.NODE_ENV === 'test' ?
10+
() => '2017-02-23' :
11+
() => new Date().toISOString().substring(0, 10);
812

9-
export function getToday() {
10-
return process.env.NODE_ENV === 'test' ? '2017-02-23' : new Date().toISOString().substring(0, 10);
11-
}
13+
let assetRoot = '/assets';
1214

1315
export function setAssetRoot(path) {
1416
assetRoot = path;

0 commit comments

Comments
 (0)