Add optional chaining and nullish coalescing (#953)

* Support nullish-coalescing-operator

* Support optional chaining
This commit is contained in:
Jordan Eldredge 2019-11-19 09:15:28 -08:00
parent dffb0949a5
commit 005880a052
5 changed files with 802 additions and 224 deletions

View file

@ -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"
],

View file

@ -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,
},

View file

@ -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;

View file

@ -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",
@ -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",

999
yarn.lock

File diff suppressed because it is too large Load diff