ActiveFunctions
The ActiveFunctions filter provides functionality inspired by (but not limited to) Rails’ ActiveSupport. It works in conjunction with the tiny NPM dependency @ruby2js/active-functions
which must be added to your application.
value.blank?
blank$(value)
value.present?
present$(value)
value.presence
presence$(value)
value.chomp
chomp$(value)
value.chomp(suffix)
chomp$(value, suffix)
value.delete_prefix(prefix)
delete_prefix$(value, prefix)
value.delete_suffix(suffix)
delete_suffix$(value, suffix)
Note: these conversions are only done if eslevel
>= 2015. Import statements
will be added to the top of the code output automatically. By default they
will be @ruby2js/active-functions
, but you can pass an import_from_skypack: true
option to convert
to use the Skypack CDN instead.