Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
splitargs2
Advanced tools
Readme
Splits a string into tokens by a given separator, treating any quoted parts as a single token.
This project is a fork of splitargs which has been completely rewritten to use modern JavaScript standards.
npm i -s splitargs2
yarn add splitargs2
Parameters:
string
The string to tokenizeoptional
keepQuotes boolean
If true, quoted tokens will maintain their quote characters. Default: false
optional
separator ?RegExp
Matches separators for tokens. Default: /\s/g
Returns: string[]
The tokens extracted from the text.
const splitargs = require('splitargs2');
console.log(splitargs("Hello, world!"));
// [ 'Hello,', 'world!' ]
console.log(splitargs("My name is \"Stan Pines\""));
// [ 'My', 'name', 'is', 'Stan Pines' ]
// With keepQuotes as true:
console.log(splitargs('Keep "these quotes," please.', true));
// [ 'Keep', '"these quotes,"', 'please.' ]
// Using a custom separator:
const dashMatcher = /\-/g;
console.log(splitargs('4000-1234-5678-9010', false, dashMatcher));
// [ '4000', '1234', '5678', '9010' ]
Copyright 2018 Shinobu1337
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
FAQs
Splits a string into tokens by a given separator, treating any quoted parts as a single token.
The npm package splitargs2 receives a total of 14 weekly downloads. As such, splitargs2 popularity was classified as not popular.
We found that splitargs2 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.