Huge News!Announcing our $40M Series B led by Abstract Ventures.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.2.0 to 0.2.1

fptime.js

6

index.js

@@ -14,3 +14,7 @@ /**

timeit: require('./lib/timeit.js'),
http_build_query: require('./lib/http_build_query.js'),
http_build_query: require('./http_build_query.js'),
http_parse_query: require('./http_parse_query.js'),
urldecode: require('./http_parse_query.js').urldecode,
getrusage: require('./getrusage'),
fptime: require('./fptime'),

@@ -17,0 +21,0 @@ /***

20

package.json
{
"name": "arlib",
"version": "0.2.0",
"description": "Andras' Utility Functions",
"version": "0.2.1",
"description": "Andras' library of handy utility functions",
"license": "Apache-2.0",

@@ -32,6 +32,5 @@ "repository": {

"mongoid",
"uniqueid",
"unique",
"unique id",
"id",
"mongo",
"mongo id",
"phpdate",

@@ -44,7 +43,12 @@ "datetime",

"timeit",
"http_build_query"
"http_build_query",
"http_parse_query",
"urldecode",
"getrusage",
"gettimeofday"
],
"dependencies": {
"mongoid-js":"1.0",
"phpdate-js":"1.0"
"mongoid-js":"1.0.5",
"phpdate-js":"1.0.0",
"qrusage":"1.0.5"
},

@@ -51,0 +55,0 @@ "devDependencies": {

@@ -181,1 +181,38 @@ arlib

leave_brackets encode {a:[3]} as "a[0]=3" and not "a%5B0%5D=3"
### http_parse_query( string )
build up the parameters hash from the PHP-style query string. Parses
name-value pairs as expected, `a=1&b=2` is `{a:1, b:2}`. names value-less
names as if set to one, i.e. `a&b` becomes {a:1, b:1}. Unlike PHP, gathers
repeated parameters into arrays (e.g., `a=1&a=2` is `{a: [1, 2]}` and not a=2.
Like PHP, parses hierarchical values like `a[i][j]=1` into `{a: {i: {j:1}}}`.
var http_parse_query = require('arlib/http_parse_query');
var params = http_parse_query("a=1&b=2&c[0]=3&c[1]=4&c[2][0]=5");
// => {a:1, b:2, c:{'0':3, '1':4, '2':{'0':5}}}
TODO: flat numerical hierarchies should be converted to arrays, not objects..
Currently `a[0]=1&a[1]=2` parses a into the object `{'0':1, '1':2}` and not
`[1, 2]`. This is not symmetric with http_build_query() behavior.
### getrusage
the unix `getrusage(2)` system call, from the
[qrusage](https://www.npmjs.org/package/qrusage) package. See the package for
details. The fields names have the ru_ stripped, and the struct timevals are
combined into floating-point time values.
var getrusage = require('arlib/getrusage');
var usage = getrusage();
### fptime
the current microsecond precision timestamp as a floating point number.
Analogous to the `time(2)` system call (implemented with `gettimeofday(2)`).
Also from the [qrusage](https://www.npmjs.org/package/qrusage) package.
var fptime = require('arlib/fptime');
var timestamp = fptime();

Sorry, the diff of this file is not supported yet

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