Mandujano: Doing the check twice
Mandujano: Or storing it in state
Shimko: Xckpd7: console.log generally prints a reference to the object and the console expands it
Flagel: Xckpd7: Try console.logJSON.stringifyobj
Murilla: Tejasmanohar: this is how I’d probably have written it: https://gist.github.com/robotlolita/7396b1e4f59c37855761
Rothacher: Tejasmanohar: var aggregate = a = b = Object.***ign{}, b, a
Siordia: Well. this is definitely not what i expected to see
Klaich: Tejasmanohar: Failure/Validation would be from here: https://github.com/folktale/data.validation
Swartzentrube: Which is what I use for all validation stuff
Reinken: STRML: my question has to do with logging the before and after way an object should be and it’s not logging what I’m expecting
Misumi: Xckpd7: Yes, try my suggestion
Delong: Thanks for showing me this library, Sorella
Garity: It doesn’t actually have a .toPromise method, but you could very easily convert Validation to Promise
Brittsan: Usman: I’m working on a live example
Mingus: Xckpd7: Maybe re-read my comment because it addressed exactly what you asked
Berteotti: I did read it but I guess I didn’t understand? let me read again
Foltz: Except i think just for now this may be an overkill solution for my simple problem
Nasalroad: Xckpd7, http://jsfiddle.net/progysm/j138o7mn/2/
Draney: Writing the toPromise funciton and all
Shintani: Tejasmanohar: probably
Bruschke: Just feels like too much 😛
Buel: STRML: I don’t get what stringifying has to do with that
Hjalmarson: Xckpd7: You’re doing this in the chrome console, right
Agne: If i wanted to write a function that’s pretty specific to my use case here and not like a util function that i’d use all over my backend codebase. do i still keep it in the controller?
Crone: For example,a function with the logic i was talking about here if req.body.phoneNumber { const phoneNumber = formatCountryreq.body.phoneNumber; const source = ‘website’; } else if req.body.From { const phoneNumber = formatCountryreq.body.From; const source = ‘cookie’; }
Jensrud: Tejasmanohar: you really start seeing the benefits when you have to do a lot of validation, and compose them. So, for example, instead of failing right away when you see that the username is invalid, you might want to return all of the errors to the user. Data.Validation helps with that
Polfer: Xckpd7: What actually happens when you console.log an object is that the console saves a reference to that object for expansion. And since the object was mutated, what you see is the mutated version of the object since console.log in both cases is the same reference
Norcross: Xckpd7: So if you actually want to see the values inside, turn the reference into a value by using JSON.stringifyobj and logging that instead
Kindl: Tejasmanohar: I don’t do MVC, so iunno
Burghard: STRML: interesting. ok
Schoolfield: I have some “libs” of functions internally like in lib/util/string.js and lib/util/number.js etc but in my controller i don’t know if i should put that function in the controller or what
Billus: Tejasmanohar: I just keep everything logically grouped. So things that belong together stay in the same module
Monsen: Probably a helper in the controller
Herriot: Yeah fair enough i don’t want to use MVC in my next project either Sorella
Carvill: It’s not really “V”, “V” is jsut the API response in my case
Nasalroad: Mvc as in microsoft visual c++ ?
Nasalroad: Multi-Virus Cleaner ?
Cerrito: Opinions? http://www.hamsters.io/
Nasalroad: I don’t want to see the input/output of hamsters
Drawe: STRML: yeah that worked. interesting. do I need to write some console.log utility to stringify / unstringify?