I am an active member of Ruby community. I have been consistently contributing to Ruby on Rails for a number of years and now am one of the top 30 contributors to Ruby on Rails. I also help as co-editor for the This week in Rails newsletter. Besides Ruby on Rails I have also contributed to many other notable open source projects including Sinatra, Devise and Rake. I am a seasoned speaker an have spoken at many conferences around the world including Gogaruco in San Francisco, RedDotRubyConf in Singapore, RubyConfIndia in Goa, India MadisonPlusRuby in Madison, Wisconsin, RubyConfBrazil in Suo Paulo, Brazil, and RubyConf Philippines in Manilla, Philippines. I am organizer of Deccan Ruby Conference and used to run RubyIndia Podcast. During my early days of open source as part of "Google summer of code" I contributed to the krypt-project project. Later I helped mentor in the JRuby and currently mentor in the Ruby on Rails organization for Google summer of code. When not working on Ruby, I am mostly working on Reactjs. I have authored the book Building Modern Web Applications with React.js which is published by PACKT. I have produced a number of screencasts on the topic of Learn React.js.
2 minute read
recently reached to a release candidate,
One of the new additions are logical assignment operators (??=, &&=, ||=)
which combine the logical operations(&&, || or ??) with assignment(=).
Let’s take a look at some examples of these and their use cases.
Logical nullish assignment (??=)
Logical nullish assignment operator assigns a value to a
variable if it is currently nullish (undefined or null).
This can come in handy in cases where
we’d want to fill out missing properties or options.
Logical AND assignment (&&=)
Logical AND assignment operator assigns
a value to a variable if it is currently
This helps us simplify some of the checks for
presence/truthiness before assigning values.
Logical OR assignment (||=)
Logical OR assignment operation assigns a value to a variable if it is currently
Same as logical AND,
this helps us simplify some of the checks for presence/truthiness before assigning values.
Using ES2021 features in codebase
The new ES2021 features are
by recent versions of major browsers.
To enable these features in old browsers, we need to do the below setup.
Install Babel packages:
Create the babel.config.json file at the root of the project.
Create a .browserlistrc file at the root of the project to
specify the target browsers for Babel to transform code in -
Run the below command.
It will transform the files in the src folder into a compatible version for old browsers
and output in the lib folder.
The newly added logical assignment operators,
help us simplify conditional assignments and evaluations,
in a better way.