Skip to content

Commit

Permalink
fix!: deprecate functions in object.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-fenichel committed Aug 26, 2022
1 parent 3bc42c5 commit c993093
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions core/shortcut_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,8 @@ export class ShortcutRegistry {
* @throws {Error} if the modifier is not in the valid modifiers list.
*/
private checkModifiers_(modifiers: KeyCodes[]) {
const validModifiers = object.values(ShortcutRegistry.modifierKeys);
for (let i = 0, modifier; modifier = modifiers[i]; i++) {
if (validModifiers.indexOf(modifier) < 0) {
if (!(modifier in ShortcutRegistry.modifierKeys)) {
throw new Error(modifier + ' is not a valid modifier key.');
}
}
Expand Down
12 changes: 5 additions & 7 deletions core/utils/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import * as deprecation from './deprecation.js';
* @alias Blockly.utils.object.inherits
*/
export function inherits(childCtor: Function, parentCtor: Function) {
deprecation.warn(
'Blockly.utils.object.inherits', 'September 2022', 'September 2023', 'normal inheritance');
// Set a .superClass_ property so that methods can call parent methods
// without hard-coding the parent class name.
// Could be replaced by ES6's super().
Expand Down Expand Up @@ -86,11 +88,7 @@ export function deepMerge(
* @alias Blockly.utils.object.values
*/
export function values(obj: AnyDuringMigration): AnyDuringMigration[] {
if (Object.values) {
return Object.values(obj);
}
// Fallback for IE.
return Object.keys(obj).map(function(e) {
return obj[e];
});
deprecation.warn(
'Blockly.utils.object.values', 'September 2022', 'September 2023', 'Object.values');
return Object.values(obj);
}

0 comments on commit c993093

Please sign in to comment.