Skip to content

i22-digitalagentur/epic-hash-cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EpicHashCleaner

Build Status

Removes recursively nil and empty elements from a hash

# Examples

EpicHashCleaner.clean { a: nil, b: '', c: [], d: {} }
# => {}

EpicHashCleaner.clean { a: false, b: ' ' }
# => { a: false }

EpicHashCleaner.clean { a: [nil], b: [nil, '', [{}], { a: [''] }] }
# => {}

EpicHashCleaner.clean { a: { b: { c: [{ d: ['', 1], e: nil }] } } }
# => { a: { b: { c: [{ d: [1] }] } } }

EpicHashCleaner.clean nil
# => {}

Installation

Add this line to your application's Gemfile:

gem 'epic_hash_cleaner'

And then execute:

$ bundle

Or install it yourself as:

$ gem install epic_hash_cleaner

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/i22-digitalagentur/epic-hash-cleaner

License

The gem is available as open source under the terms of the MIT License.

About

Removes recursively nil and empty elements from a hash

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published