JS-Try is a Javascript implementation of the try method from Rails for safe navigation.
Install
Yarn, NPM, or Bower
yarn add js-try npm install js-try bower install js-try
Rails / Bundler
# Gemfile source 'https://rails-assets.org' do end # app/assets/javascripts/application.js /* *= */
Usage
Require/Import
var Try = ;// or;
Basic Examples
== false; == false; == false; == true; == 0; == ''; == 'foobar'; == ; == {}; false == false;true == false; '' == 0;'' == false;'foobar' == 'b';''; == false var x = 0;x == '0';x == false; == ; == false;123 == 3;123 == false; {} == "[object Object]";{} == false;foo: 'bar' == 'bar';foo: 'bar' == false;
Credits
Created by Weston Ganger - @westonganger
For any consulting or contract work please contact me via my company website: Solid Foundation Web Development