Skip to content

Commit

Permalink
Add optional chaining and nullish coalescing (#953)
Browse files Browse the repository at this point in the history
* Support nullish-coalescing-operator

* Support optional chaining
  • Loading branch information
captbaritone committed Nov 19, 2019
1 parent 4302806 commit 81b3b11
Show file tree
Hide file tree
Showing 5 changed files with 802 additions and 224 deletions.
2 changes: 2 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-class-properties"
],
Expand Down
2 changes: 1 addition & 1 deletion js/reducers/tracks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const tracks = (
[action.id]: {
id: action.id,
defaultName: action.defaultName || null,
duration: action.duration == null ? null : action.duration,
duration: action.duration ?? null,
url: action.url,
mediaTagsRequestStatus: MEDIA_TAG_REQUEST_STATUS.INITIALIZED,
},
Expand Down
3 changes: 1 addition & 2 deletions js/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ export const getTracksMatchingFilter = createSelector(getTracks, tracks => {

export const getTrackUrl = (state: AppState) => {
return (id: number): string | null => {
const track = state.tracks[id];
return track == null ? null : track.url;
return state.tracks[id]?.url;
};
};
export const getTrackOrder = (state: AppState) => state.playlist.trackOrder;
Expand Down
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,20 @@
},
"homepage": "https://github.com/captbaritone/webamp/",
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/node": "^7.6.1",
"@babel/core": "^7.7.2",
"@babel/node": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-modules-commonjs": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.6.2",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.0.0",
"@babel/runtime": "^7.0.0",
"@babel/polyfill": "^7.7.0",
"@babel/preset-env": "^7.7.1",
"@babel/preset-react": "^7.7.0",
"@babel/preset-typescript": "^7.7.2",
"@babel/runtime": "^7.7.2",
"@types/classnames": "^2.2.6",
"@types/css-font-loading-module": "^0.0.2",
"@types/fscreen": "^1.0.1",
Expand All @@ -79,10 +81,10 @@
"@types/react-redux": "^7.1.1",
"@types/webaudioapi": "^0.0.27",
"@typescript-eslint/eslint-plugin": "^2.6.1",
"@typescript-eslint/parser": "^2.6.1",
"@typescript-eslint/parser": "^2.7.0",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^9.0.0-beta.3",
"babel-jest": "^24.9.0",
"babel-jest": "^23.4.2",
"babel-loader": "^8.0.4",
"butterchurn": "^2.6.7",
"canvas-mock": "0.0.0",
Expand Down
Loading

0 comments on commit 81b3b11

Please sign in to comment.