
Security News
PyPI Expands Trusted Publishing to GitLab Self-Managed as Adoption Passes 25 Percent
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads
LTSV parser and formatter
$ npm install ltsv
$ bower install ltsv
var ltsv = require('ltsv');
<script src="ltsv.min.js"></script>
ltsv.parse(
'label1:value1\tlabel2:value2\n' +
'label1:value1\tlabel2:value2\n' +
'label1:value1\tlabel2:value2'
);
// [ { label1: 'value1', label2: 'value2' },
// { label1: 'value1', label2: 'value2' },
// { label1: 'value1', label2: 'value2' } ]
ltsv.parseLine('label1:value1\tlabel2:value2');
// { label1: 'value1', label2: 'value2' }
ltsv.parseLine('label1:value1\tlabel2:value2\n');
// { label1: 'value1', label2: 'value2' }
ltsv.parseLine('label1:value1\tlabel2:value2\r\n');
// { label1: 'value1', label2: 'value2' }
ltsv.format([
{ label1: 'value1', label2: 'value2' },
{ label1: 'value1', label2: 'value2' },
{ label1: 'value1', label2: 'value2' }
]);
// 'label1:value1\tlabel2:value2\nlabel1:value1\tlabel2:value2\nlabel1:value1\tlabel2:value2'
ltsv.format({ label1: 'value1', label2: 'value2' });
// 'label1:value1\tlabel2:value2'
var fs = require('fs'),
ltsv = require('ltsv'),
ltjs = ltsv.createLtsvToJsonStream({
toObject: false,
strict: false
});
// access.log:
// l1:v1\tl2:v2\n
// l1:v1\tl2:v2\n
// l1:v1\tl2:v2\n
fs.createReadStream('./access.log').pipe(ltjs).pipe(process.stdout);
// {"l1":"v1","l2":"v2"}{"l1":"v1","l2":"v2"}{"l1":"v1","l2":"v2"}
text string - LTSV textreturn Object[] - parsed objectssplit to LTSV records.
throw SyntaxError if text has no separator.
line string - LTSV linereturn Object - parsed objectsplit to LTSV record.
throw SyntaxError if line has no separator.
text string - LTSV textreturn Object[] - parsed objectssplit to LTSV records and validate label and value of fields.
throw SyntaxError if text has no separator.
also throw SyntaxError if text has unexpected character.
line string - LTSV linereturn Object - parsed objectsplit to LTSV record.
throw SyntaxError if line has no separator.
also throw SyntaxError if line has unexpected character.
mixed Object|Object[] - object or object arrayreturn string - LTSV textconvert to LTSV text.
throw TypeError if mixed is not an object or array.
mixed Object|Object[] - object or object arrayreturn string - LTSV textconvert to LTSV text.
throw TypeError if mixed is not an object or array.
also throw SyntaxError if mixed has unexpected character.
options object - option objectreturn LtsvToJsonStream - LTSV to JSON streamreturn LtsvToJsonStream instance. cannot use by browser.
encoding string - StringDecoder encodingtoObject boolean - flag of send to objectstrict boolean - flag of strict parseStringDecoder's encoding.
if not set, use "utf8".
send object if toObject is true.
otherwise send JSON string.
if not set, toObject is false.
strict parse if strict is true.
otherwise not strict parse.
if not set, strict is false.
$ npm install
$ npm test
$ npm install
$ npm run-script bower
$ npm run-script testem
The MIT License. Please see LICENSE file.
FAQs
LTSV parser, formatter, validator and TransformStream
The npm package ltsv receives a total of 663 weekly downloads. As such, ltsv popularity was classified as not popular.
We found that ltsv 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
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.