File tree Expand file tree Collapse file tree 4 files changed +6389
-4898
lines changed
Expand file tree Collapse file tree 4 files changed +6389
-4898
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change @@ -2247,30 +2247,34 @@ export function safeVarName(s) {
22472247}
22482248export function pick ( o , keys ) {
22492249 const to = { } ;
2250- for ( const k in o ) {
2251- if ( o . hasOwnProperty ( k ) && keys . indexOf ( k ) >= 0 ) {
2250+ Object . keys ( o ) . forEach ( k => {
2251+ if ( keys . indexOf ( k ) >= 0 ) {
22522252 to [ k ] = o [ k ] ;
22532253 }
2254- }
2254+ } ) ;
22552255 return to ;
22562256}
22572257export function omit ( o , keys ) {
22582258 const to = { } ;
2259- for ( const k in o ) {
2260- if ( o . hasOwnProperty ( k ) && keys . indexOf ( k ) < 0 ) {
2259+ if ( ! o )
2260+ return to ;
2261+ Object . keys ( o ) . forEach ( k => {
2262+ if ( keys . indexOf ( k ) < 0 ) {
22612263 to [ k ] = o [ k ] ;
22622264 }
2263- }
2265+ } ) ;
22642266 return to ;
22652267}
22662268export function omitEmpty ( o ) {
22672269 const to = { } ;
2268- for ( const k in o ) {
2270+ if ( ! o )
2271+ return to ;
2272+ Object . keys ( o ) . forEach ( k => {
22692273 const v = o [ k ] ;
22702274 if ( v != null && v !== '' ) {
22712275 to [ k ] = v ;
22722276 }
2273- }
2277+ } ) ;
22742278 return to ;
22752279}
22762280export function apply ( x , fn ) {
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments