diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-04-16 14:09:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-16 14:09:07 +0200 |
commit | 0bb96cde726127291dccb62145e76a50b2efcd2f (patch) | |
tree | e18e2512369c5c1393c2e45efef594e1e8ca4af5 /ext/web/15_performance.js | |
parent | 8b31fc23cd80de9baa62535e95367da7a21c9cfd (diff) |
refactor: update runtime code for primordial check x in y (#13642)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Diffstat (limited to 'ext/web/15_performance.js')
-rw-r--r-- | ext/web/15_performance.js | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/ext/web/15_performance.js b/ext/web/15_performance.js index c48a3d888..41b40159e 100644 --- a/ext/web/15_performance.js +++ b/ext/web/15_performance.js @@ -10,6 +10,7 @@ ArrayPrototypeSlice, ObjectKeys, ObjectPrototypeIsPrototypeOf, + ReflectHas, Symbol, SymbolFor, TypeError, @@ -470,17 +471,17 @@ throw new TypeError("Options cannot be passed with endMark."); } if ( - !("start" in startOrMeasureOptions) && - !("end" in startOrMeasureOptions) + !ReflectHas(startOrMeasureOptions, "start") && + !ReflectHas(startOrMeasureOptions, "end") ) { throw new TypeError( "A start or end mark must be supplied in options.", ); } if ( - "start" in startOrMeasureOptions && - "duration" in startOrMeasureOptions && - "end" in startOrMeasureOptions + ReflectHas(startOrMeasureOptions, "start") && + ReflectHas(startOrMeasureOptions, "duration") && + ReflectHas(startOrMeasureOptions, "end") ) { throw new TypeError( "Cannot specify start, end, and duration together in options.", @@ -492,13 +493,13 @@ endTime = convertMarkToTimestamp(endMark); } else if ( typeof startOrMeasureOptions === "object" && - "end" in startOrMeasureOptions + ReflectHas(startOrMeasureOptions, "end") ) { endTime = convertMarkToTimestamp(startOrMeasureOptions.end); } else if ( typeof startOrMeasureOptions === "object" && - "start" in startOrMeasureOptions && - "duration" in startOrMeasureOptions + ReflectHas(startOrMeasureOptions, "start") && + ReflectHas(startOrMeasureOptions, "duration") ) { const start = convertMarkToTimestamp(startOrMeasureOptions.start); const duration = convertMarkToTimestamp(startOrMeasureOptions.duration); @@ -509,13 +510,13 @@ let startTime; if ( typeof startOrMeasureOptions === "object" && - "start" in startOrMeasureOptions + ReflectHas(startOrMeasureOptions, "start") ) { startTime = convertMarkToTimestamp(startOrMeasureOptions.start); } else if ( typeof startOrMeasureOptions === "object" && - "end" in startOrMeasureOptions && - "duration" in startOrMeasureOptions + ReflectHas(startOrMeasureOptions, "end") && + ReflectHas(startOrMeasureOptions, "duration") ) { const end = convertMarkToTimestamp(startOrMeasureOptions.end); const duration = convertMarkToTimestamp(startOrMeasureOptions.duration); |