You’re doing two distinct.

 
Villalouos: I’m determining another variable based on the variable i choose to ***ign to x cjohnson

Usman: You could refactor it but it would basically be just as “messy” in your refactor

Mandujano: Tejasmanohar: It’s clean as far as I can tell. Reads very easy. Intent is very explicit and code is nicely spaced. Keep your methods small and have them do one thing or call other methods to do more than one thing. Nothing messy here :

Stoff: Tejasmanohar: using sum types would be the best way, but JS doesn’t have good ways of encoding this, unfortunately :/

Pokorski: Usman: so you think i should validate on file extensions on the front end?

Serbus: I’ll make another function

Usman: Jeffreylevesque: I think you should re-read what I just wrote becausae I explained exactly my position on this 😛

Mandujano: Maybe have const phoneNumber = getPhoneNumber, const source = getSource, and do the check multiple times

Usman: Lotus: yeah but basically equally “messy”

Mandujano: If ! phoneNumber = getPhoneNumber return res.error .

Usman: I think they’re both fine approaches

Maslen: I don’t like that approach, sorry lotus. i don’t want to check the same thing multiple times.

Skarupa: I guess that’s the only other way though

Hardy: Could make a function that returns an object with source and phoneNumber and then do const { phoneNumber, source } = myFunc; lotus cjohnson

Mandujano: Usman: I dunno if ! phone = getPhone then return error. source = getSource ret.success{data: {await getPre};

Mah: Question: what’s the deal with “delete”? is there a chance that console logging stuff before / aftering deleting them would cause a discrepancy in what’s reported?

Mandujano: Yes! and why didn’t that tag on my name highlight?

Debus: That will destructure + 1-liner

Niederer: And no repeated logic

Atherley: Lotus: . weird, must be somtehing with your client

Usman: Xckpd7: delete is only useful for removing properties from objects. and to answer your question, yes, things can absolutely change between time you’re viewing console and the time it was called console.log

Mandujano: You can have the “check” for req in another method that stores it as state

Usman: Xckpd7: for instance if you do var foo = {a:’a’}; console.logfoo; foo.a = ‘b’;

Usman: Then you expand the arrow in your console to inspect the properties, you’ll see a: ‘b’

Mandujano: See? It’s clean enough.

Usman: Xckpd7: If you want a snapshot of how it currently looks in time I would do console.logJSON.stringifyfoo

Delavega: I don’t quite follow what you mean, lotus

Gruesbeck: I have to p*** req into the function i just mentioned

Fieldhouse: Or req.body etc, of course

Nestler: Usman: http://jsfiddle.net/j138o7mn/

Wada: That’s not working code but hopefully you can get the idea

Rollison: Actually let me clean that up

Hovey: Lotus: https://gist.github.com/tejasmanohar/4f858fb56cc55ced067f

Sartwell: P*** in req.body to that function, there

Rykaczewski: Http://jsfiddle.net/j138o7mn/1/

Heisdorffer: Alright so basically I’m taking an array and using it to delete keys in an object

Sweadner: If I console log before and after, it only shows the aftermath of deleting, not the state of it before I did it

Mandujano: The name of that function is bad, tejasmanohar

Usman: Xckpd7: this.state, and then state?

Nasalroad: DeleteState.mapfunc, this;

Usman: Can you make this like an actual working fiddle so I can see what you mean?

Hatridge: Lotus: is that the method that you were suggesting though?

Rousu: If not, would you make a gist? i’m curious now. ;

Mandujano: You’re doing two distinct things in that method. My approach involves getPhone and getSource