
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
lookaround-enumerable
Advanced tools
When working with time series, it is common to perform operations that depend on a sliding window of values. Lookaround Enumerable adds two main methods, and several sub-helpers to assist with running map/collect, reduce/inject, and find_all/select queries that depend on the previous values (Enumerable#each_with_prev), or a whole window of values (Enumerable#each_with_window). This gem contains these methods as refinements.
Add this line to your application's Gemfile:
gem 'lookaround-enumerable'
And then execute:
$ bundle
Or install it yourself as:
$ gem install lookaround-enumerable
require 'lookaround-enumerable'
using LookaroundEnum
The LookaroundEnum
contains the refinements, so they can be targeted to selected areas of code.
# Maps characters after a capital letter to "x"
"AbCdefgHiJKl".each_char.map_with_prev(1, filler: "a") {|x, previous| previous.upcase == previous ? "x" : x}.join
# => "AxCxefgHxJxx"
# select characters surrounded by > <, ignoring the bounds (crop)
"Ab>c<defg>h<i>j<kLm>n<op".each_char.select_with_window(-1..1, crop: true) { |left, item, right| left + right == "><" }.join
# => "cjhn"
filler:
crop: true
trim: true
See the documentation spec tests under spec/
for more examples.
That's a tricky question. By default, single left/right views should just work, but you might have to play with the expand
parameter or do a p *args
to figure out more advanced usage, like chaining with memos or objects. The each_with_prev
family does |(*this), ((*previous1), ..., (*previous_n))|
with older/lower indexes to the right. The each_with_window
family does |((*previous_n), ..., (*previous1)), (*this), ((*next1), ..., (*next_n))|
with older/lower indexes on the left.
After checking out the repo, run bundle install
to install dependencies. Then, run rake spec
or rspec
to run the tests.
Bug reports and pull requests are welcome on GitHub at https://github.com/byteit101/lookaround-enumerable.
FAQs
Unknown package
We found that lookaround-enumerable 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.