class SvelteOnRails::Lib::SvelteAttributes

def extract_limit(attributes)

def extract_limit(attributes)
  _hash_args = attributes.grep(Hash).first.dup
  attr, lim = if _hash_args.present?
                hash_args = _hash_args.transform_keys { |key| key.to_s } # multiple arrays is not possible
                hash_remainder = hash_args.reject { |key, _| %w[offset limit].include?(key.to_s) }
                _attr = attributes.reject { |item| item.is_a?(Hash) }
                [
                  if hash_remainder.any?
                    _attr + [hash_remainder]
                  else
                    _attr
                  end,
                  hash_args
                ]
              else
                [
                  attributes,
                  {}
                ]
              end
  [
    lim['offset'],
    lim['limit'],
    attr
  ]
end