New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arlib

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arlib - npm Package Compare versions

Comparing version 0.0.3 to 0.0.5

fgets.js

23

lib/getopt.js

@@ -68,3 +68,3 @@ /**

if (typeof options === 'string') options = parseOptionsString(options);
options = normalizeOptionsObject(options);
if (getopt.normalizeOptionsObject) options = getopt.normalizeOptionsObject(options);

@@ -86,3 +86,3 @@ while ((opt = nextopt(argv, options))) {

options[name] &&
options[name].argc === 1)
options[name] === 1 || options[name].argc === 1)
{

@@ -101,6 +101,6 @@ // allow equals-separated option params, eg --value=3

found._prog = argv[0];
found._program = argv[0];
found._script = argv[1];
found._argv = argv.slice(2);
found._options = options;
found._recognizedOptions = options;

@@ -132,19 +132,4 @@ return found;

function normalizeOptionsObject( options ) {
var name;
for (name in options) {
if (typeof options[name] === 'number') {
options[name] = {argc: options[name], help: ""};
}
}
for (name in options) {
while (options[name] === 'string' && options[options[name]]) {
options[name] = options[options[name]];
}
}
return options;
}
// quick test:
// console.log( getopt("js test.js -a 1 -name=value --verbose --value=33 -c -b 2 3 -- -d foo".split(" "), "a:(name):b::c(-verbose)(-value):d:") );
{
"name": "arlib",
"version": "0.0.3",
"version": "0.0.5",
"description": "Andras' Utility Functions",

@@ -26,3 +26,6 @@ "license": "Apache-2.0",

"fast",
"utilities"
"utilities",
"getopt",
"tempnam",
"fgets"
],

@@ -29,0 +32,0 @@ "dependencies": {

@@ -10,2 +10,15 @@ # arlib

The components are all available with `require('arlib')`, or each component
is loadable separately with eg `require('arlib/tempnam')`.
### tempnam
php tempnam equivalent, creates a filename that does not exist on the
system. Like php, it also creates the file to prevent the name from
being reused.
var tempnam = require('arlib/tempnam');
var filename = tempnam("/usr/tmp", "filename-prefix-");
// /usr/tmp/filename-prefix-a7259b
### getopt

@@ -22,10 +35,18 @@

### tempnam
### Fgets
php tempnam equivalent, creates a filename that does not exist on the
system. Like php, it also creates the file to prevent the name from
being reused.
synchronous line-at-a-time stream reader. Returns the next buffered line
or the empty string "" when the buffer is empty.
var tempnam = require('arlib/tempnam');
var filename = tempnam("/usr/tmp", "filename-prefix-");
// /usr/tmp/filename-prefix-a7259b
var fs = require('fs');
var Fgets = require('arlib').Fgets;
var fp = new Fgets(fs.createReadStream(filename, 'r'));
// line = fp.fgets();
#### FileReader
fast file reader to fee data to fgets, 30% faster than read streams.
var FileReader = require('arlib').FileReader;
var fp = new Fgets(new FileReader(filename));
// line = fp.fgets();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc