Ranter
Join devRant
Do all the things like
				++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
				Sign Up
			Pipeless API
 
				From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
				Learn More
			Comments
		- 
				
				Whats the background?
 
 I don't like this kind of checking, especially when there are function calls involved that execute a numerous times just to get a part of the last call.
- 
				
				JavaScript doesn’t have “safe navigation”, the ?. operator https://en.m.wikipedia.org/wiki/... ? Looks like CoffeeScript does, I wonder how they unroll it then....
- 
				
				@bkwilliams nope no safe navigation in vanilla JS. You most likely end up doing what op's extension does.
 
 One could also use lodash's get method.
- 
				
				@Commodore when C# got it it changed my coding style completely, much more readable.
- 
				
				 Orek12927y@010001111 In the company I’m currently working we dont have access to source, to be able to use default functionalities / data we must wait for it to arrive first. So this is the way we are dealing with exceptions. && operator is the most optimized solution found so far. Orek12927y@010001111 In the company I’m currently working we dont have access to source, to be able to use default functionalities / data we must wait for it to arrive first. So this is the way we are dealing with exceptions. && operator is the most optimized solution found so far.
- 
				
				 Orek12927y@bkwilliams custom accessor functions are very slow in comparison to try catch or && operators Orek12927y@bkwilliams custom accessor functions are very slow in comparison to try catch or && operators
- 
				
				 Orek12927y@Commodore its very slow, you can check plugin’s page I published tests with few methods, && seems to be most optimized way so far Orek12927y@Commodore its very slow, you can check plugin’s page I published tests with few methods, && seems to be most optimized way so far
- 
				
				 Orek12927y@bkwilliams for js there is a stage 3 proposal for elvis like accessor but it may take ages to see it in browsers Orek12927y@bkwilliams for js there is a stage 3 proposal for elvis like accessor but it may take ages to see it in browsers
- 
				
				@Orek yes it is. Don't get me wrong, I'm not arguing the usefulness of your extension. Checking every property is a pain. Although I tend to try avoid such problems by either flattening my data structure or using variables.
- 
				
				 Orek12927y@Commodore && chain is much faster than _get and you don’t need to import a library to your project by this extension :)) I understand and appreciate your comment. Yes in cases where you can influence the object you are going to use that totally makes sense Orek12927y@Commodore && chain is much faster than _get and you don’t need to import a library to your project by this extension :)) I understand and appreciate your comment. Yes in cases where you can influence the object you are going to use that totally makes sense
Related Rants





 A dev can dream, right...?
A dev can dream, right...?


Just published vscode extension to auto transform object accessors to nullable / safer accessors (&& chain).
search for “vscode-oat” in marketplace.
Looking for feedbacks :)
rant
extensions
vscode extensions
vscode
vscodeđź’—