Skip to content

Commit 005880a

Browse files
committed
Add optional chaining and nullish coalescing (#953)
* Support nullish-coalescing-operator * Support optional chaining
1 parent dffb094 commit 005880a

File tree

5 files changed

+802
-224
lines changed

5 files changed

+802
-224
lines changed

.babelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"@babel/preset-typescript"
2323
],
2424
"plugins": [
25+
"@babel/plugin-proposal-nullish-coalescing-operator",
26+
"@babel/plugin-proposal-optional-chaining",
2527
"@babel/plugin-proposal-object-rest-spread",
2628
"@babel/plugin-proposal-class-properties"
2729
],

js/reducers/tracks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const tracks = (
2727
[action.id]: {
2828
id: action.id,
2929
defaultName: action.defaultName || null,
30-
duration: action.duration == null ? null : action.duration,
30+
duration: action.duration ?? null,
3131
url: action.url,
3232
mediaTagsRequestStatus: MEDIA_TAG_REQUEST_STATUS.INITIALIZED,
3333
},

js/selectors.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ export const getTracksMatchingFilter = createSelector(getTracks, tracks => {
6666

6767
export const getTrackUrl = (state: AppState) => {
6868
return (id: number): string | null => {
69-
const track = state.tracks[id];
70-
return track == null ? null : track.url;
69+
return state.tracks[id]?.url;
7170
};
7271
};
7372
export const getTrackOrder = (state: AppState) => state.playlist.trackOrder;

package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,20 @@
5353
},
5454
"homepage": "https://github.com/captbaritone/webamp/",
5555
"devDependencies": {
56-
"@babel/core": "^7.0.0",
57-
"@babel/node": "^7.6.1",
56+
"@babel/core": "^7.7.2",
57+
"@babel/node": "^7.0.0",
5858
"@babel/plugin-proposal-class-properties": "^7.0.0",
59+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
5960
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
61+
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
6062
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
6163
"@babel/plugin-transform-modules-commonjs": "^7.0.0",
6264
"@babel/plugin-transform-runtime": "^7.0.0",
63-
"@babel/polyfill": "^7.0.0",
64-
"@babel/preset-env": "^7.6.2",
65-
"@babel/preset-react": "^7.0.0",
66-
"@babel/preset-typescript": "^7.0.0",
67-
"@babel/runtime": "^7.0.0",
65+
"@babel/polyfill": "^7.7.0",
66+
"@babel/preset-env": "^7.7.1",
67+
"@babel/preset-react": "^7.7.0",
68+
"@babel/preset-typescript": "^7.7.2",
69+
"@babel/runtime": "^7.7.2",
6870
"@types/classnames": "^2.2.6",
6971
"@types/css-font-loading-module": "^0.0.2",
7072
"@types/fscreen": "^1.0.1",
@@ -79,10 +81,10 @@
7981
"@types/react-redux": "^7.1.1",
8082
"@types/webaudioapi": "^0.0.27",
8183
"@typescript-eslint/eslint-plugin": "^2.6.1",
82-
"@typescript-eslint/parser": "^2.6.1",
84+
"@typescript-eslint/parser": "^2.7.0",
8385
"babel-core": "7.0.0-bridge.0",
8486
"babel-eslint": "^9.0.0-beta.3",
85-
"babel-jest": "^24.9.0",
87+
"babel-jest": "^23.4.2",
8688
"babel-loader": "^8.0.4",
8789
"butterchurn": "^2.6.7",
8890
"canvas-mock": "0.0.0",

0 commit comments

Comments
 (0)