Sha256: 5031c43dd9d4f99db9f41dedc751c803427dc6c679a7a77a0cc13f4a4841a5d8
Contents?: true
Size: 284 Bytes
Versions: 2
Compression:
Stored size: 284 Bytes
Contents
# frozen_string_literal: true module I18nJS def self.sort_hash(hash) return hash unless hash.is_a?(Hash) hash.keys.sort_by(&:to_s).each_with_object({}) do |key, seed| value = hash[key] seed[key] = value.is_a?(Hash) ? sort_hash(value) : value end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
i18n-js-4.2.3 | lib/i18n-js/sort_hash.rb |
i18n-js-4.2.2 | lib/i18n-js/sort_hash.rb |