
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Add stable_sort
and stable_sort_by
to Array and Enumerator.
Add this line to your application's Gemfile:
gem 'stable_sort'
And then execute:
$ bundle
Or install it yourself as:
$ gem install stable_sort
stable_sort
KeyValue = Struct.new(:key, :value) do
def <=> (other)
self.key <=> other.key
end
end
[KeyValue.new(1, 1), KeyValue.new(1, 2), KeyValue.new(1, 3), KeyValue.new(1, 4), KeyValue.new(0, 10)].sort
# => [#<struct KeyValue key=0, value=10>, #<struct KeyValue key=1, value=3>, #<struct KeyValue key=1, value=2>, #<struct KeyValue key=1, value=4>, #<struct KeyValue key=1, value=1>]
[KeyValue.new(1, 1), KeyValue.new(1, 2), KeyValue.new(1, 3), KeyValue.new(1, 4), KeyValue.new(0, 10)].stable_sort
# => [#<struct KeyValue key=0, value=10>, #<struct KeyValue key=1, value=1>, #<struct KeyValue key=1, value=2>, #<struct KeyValue key=1, value=3>, #<struct KeyValue key=1, value=4>]
stable_sort_by
['a', 'c', 'bd', 'fe', 'b'].sort_by { |x| x.length }
# => ["a", "c", "b", "fe", "bd"]
['a', 'c', 'bd', 'fe', 'b'].stable_sort_by { |x| x.length }
# => ["a", "c", "b", "bd", "fe"]
Currently, stable_sort gem do not take block. If you needed, please send a pull request :)
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that stable_sort demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.