Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
intertext-splitlines
Advanced tools
Table of Contents generated with DocToc
InterText SplitLines facilitates splitting and assembling buffers into neat, decoded lines of text.
In case you have one or more buffers with textual content, the simplest way to use InterText SplitLines
is to use the splitlines()
method which will return a list of strings, each representing one line:
# For demonstration, let's assemble a number of buffers with lines
# randomly spread all over the place:
buffers = [
"helo"
" there!\nHere "
"come\na few lines\n"
"of text that are\nquite unevenly "
"spread over several\n"
"buffers.", ]
buffers = ( Buffer.from d for d in buffers )
# Now that we have a number of buffers, let's split them into text lines:
SL = require 'intertext-splitlines'
lines = SL.splitlines buffers
# lines = SL.splitlines buffers... # can call with list or spread out, as seen fit
# lines = SL.splitlines buffer_1, buffer_2, buffer_3
# lines now contains:
[ 'helo there!',
'Here come',
'a few lines',
'of text that are',
'quite unevenly spread over several',
'buffers.', ]
Observe that newline characters will be removed from the output so there's no way to determine whether the last line did or did not end with a newline; this should be the desired result most of the time. In the event that a trailing newline should be detectable, pass in an explicit setting:
lines = SL.splitlines { skip_empty_last: false, }, buffers
data
event),
call SL.walk_lines ctx, buffer
with that data; this returns an iterator over the decoded complete lines
in the buffer, if anySL.flush ctx
to receive another iterator over the last line, if anyIn JavaScript:
// for each buffer received, do:
for ( line of SL.walk_lines( ctx, buffer ) )
{ do_something_with( line ) };
// after the last buffer has been received, do:
for ( line of SL.flush( ctx ) )
{ do_something_with( line ) };
In CoffeeScript:
# for each buffer received, do:
for line from SL.walk_lines ctx, buffer
do_something_with line
# after the last buffer has been received, do:
for line from SL.flush ctx
do_something_with line
?splitter <nonempty ( text | buffer )> = '\n'
—the sequence of characters that mark linebreaks?decode <boolean> = true
—whether or not to decode buffers as UTF-8. NOTE to be replaced by
encoding
.?skip_empty_last <boolean> = true
—whether to emit an emtpy string as last item when the source ended
in splitter
.find_first_match()
, replace by buffer.indexOf()
implement splitlines()
implement setting skip_empty_last
publish v1.1.0
fix treatment of last line when emitting buffers
publish v1.1.1
encoding
FAQs
split streaming buffers into neat, decoded lines of text
The npm package intertext-splitlines receives a total of 2 weekly downloads. As such, intertext-splitlines popularity was classified as not popular.
We found that intertext-splitlines 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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.