Quellcode durchsuchen

Simplify the logic with the custom `forEach`.

Naotoshi Fujita vor 2 Jahren
Ursprung
Commit
e991baafe1
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      src/js/utils/object/omit/omit.ts

+ 2 - 2
src/js/utils/object/omit/omit.ts

@@ -1,4 +1,4 @@
-import { toArray } from '../../array';
+import { forEach } from '../../array';
 import { ownKeys } from '../ownKeys/ownKeys';
 
 
@@ -9,7 +9,7 @@ import { ownKeys } from '../ownKeys/ownKeys';
  * @param keys   - A key or keys to delete. If not specified, all own enumerable keys will be deleted.
  */
 export function omit( object: object, keys?: string | string[] ): void {
-  toArray( keys || ownKeys( object ) ).forEach( key => {
+  forEach( keys || ownKeys( object ), key => {
     delete object[ key ];
   } );
 }