Explorar el Código

Simplify the logic with the custom `forEach`.

Naotoshi Fujita hace 2 años
padre
commit
e991baafe1
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  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 ];
   } );
 }