Ver código fonte

Simplify the logic with the custom `forEach`.

Naotoshi Fujita 2 anos atrás
pai
commit
e991baafe1
1 arquivos alterados com 2 adições e 2 exclusões
  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 ];
   } );
 }