88 lines
13 KiB
JSON
88 lines
13 KiB
JSON
{
|
|
"_args": [
|
|
[
|
|
{
|
|
"raw": "jsprim@^1.2.2",
|
|
"scope": null,
|
|
"escapedName": "jsprim",
|
|
"name": "jsprim",
|
|
"rawSpec": "^1.2.2",
|
|
"spec": ">=1.2.2 <2.0.0",
|
|
"type": "range"
|
|
},
|
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/http-signature"
|
|
]
|
|
],
|
|
"_from": "jsprim@>=1.2.2 <2.0.0",
|
|
"_id": "jsprim@1.4.1",
|
|
"_inCache": true,
|
|
"_location": "/jsprim",
|
|
"_nodeVersion": "0.10.45",
|
|
"_npmOperationalInternal": {
|
|
"host": "s3://npm-registry-packages",
|
|
"tmp": "tmp/jsprim-1.4.1.tgz_1501691396911_0.08959000837057829"
|
|
},
|
|
"_npmUser": {
|
|
"name": "dap",
|
|
"email": "dap@cs.brown.edu"
|
|
},
|
|
"_npmVersion": "2.15.1",
|
|
"_phantomChildren": {},
|
|
"_requested": {
|
|
"raw": "jsprim@^1.2.2",
|
|
"scope": null,
|
|
"escapedName": "jsprim",
|
|
"name": "jsprim",
|
|
"rawSpec": "^1.2.2",
|
|
"spec": ">=1.2.2 <2.0.0",
|
|
"type": "range"
|
|
},
|
|
"_requiredBy": [
|
|
"/http-signature"
|
|
],
|
|
"_resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
|
|
"_shasum": "313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2",
|
|
"_shrinkwrap": null,
|
|
"_spec": "jsprim@^1.2.2",
|
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/http-signature",
|
|
"bugs": {
|
|
"url": "https://github.com/joyent/node-jsprim/issues"
|
|
},
|
|
"dependencies": {
|
|
"assert-plus": "1.0.0",
|
|
"extsprintf": "1.3.0",
|
|
"json-schema": "0.2.3",
|
|
"verror": "1.10.0"
|
|
},
|
|
"description": "utilities for primitive JavaScript types",
|
|
"devDependencies": {},
|
|
"directories": {},
|
|
"dist": {
|
|
"shasum": "313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2",
|
|
"tarball": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz"
|
|
},
|
|
"engines": [
|
|
"node >=0.6.0"
|
|
],
|
|
"gitHead": "f7d80a9e8e3f79c0b76448ad9ceab252fb309b32",
|
|
"homepage": "https://github.com/joyent/node-jsprim#readme",
|
|
"license": "MIT",
|
|
"main": "./lib/jsprim.js",
|
|
"maintainers": [
|
|
{
|
|
"name": "dap",
|
|
"email": "dap@cs.brown.edu"
|
|
}
|
|
],
|
|
"name": "jsprim",
|
|
"optionalDependencies": {},
|
|
"readme": "# jsprim: utilities for primitive JavaScript types\n\nThis module provides miscellaneous facilities for working with strings,\nnumbers, dates, and objects and arrays of these basic types.\n\n\n### deepCopy(obj)\n\nCreates a deep copy of a primitive type, object, or array of primitive types.\n\n\n### deepEqual(obj1, obj2)\n\nReturns whether two objects are equal.\n\n\n### isEmpty(obj)\n\nReturns true if the given object has no properties and false otherwise. This\nis O(1) (unlike `Object.keys(obj).length === 0`, which is O(N)).\n\n### hasKey(obj, key)\n\nReturns true if the given object has an enumerable, non-inherited property\ncalled `key`. [For information on enumerability and ownership of properties, see\nthe MDN\ndocumentation.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties)\n\n### forEachKey(obj, callback)\n\nLike Array.forEach, but iterates enumerable, owned properties of an object\nrather than elements of an array. Equivalent to:\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n callback(key, obj[key]);\n }\n }\n\n\n### flattenObject(obj, depth)\n\nFlattens an object up to a given level of nesting, returning an array of arrays\nof length \"depth + 1\", where the first \"depth\" elements correspond to flattened\ncolumns and the last element contains the remaining object . For example:\n\n flattenObject({\n 'I': {\n 'A': {\n 'i': {\n 'datum1': [ 1, 2 ],\n 'datum2': [ 3, 4 ]\n },\n 'ii': {\n 'datum1': [ 3, 4 ]\n }\n },\n 'B': {\n 'i': {\n 'datum1': [ 5, 6 ]\n },\n 'ii': {\n 'datum1': [ 7, 8 ],\n 'datum2': [ 3, 4 ],\n },\n 'iii': {\n }\n }\n },\n 'II': {\n 'A': {\n 'i': {\n 'datum1': [ 1, 2 ],\n 'datum2': [ 3, 4 ]\n }\n }\n }\n }, 3)\n\nbecomes:\n\n [\n [ 'I', 'A', 'i', { 'datum1': [ 1, 2 ], 'datum2': [ 3, 4 ] } ],\n [ 'I', 'A', 'ii', { 'datum1': [ 3, 4 ] } ],\n [ 'I', 'B', 'i', { 'datum1': [ 5, 6 ] } ],\n [ 'I', 'B', 'ii', { 'datum1': [ 7, 8 ], 'datum2': [ 3, 4 ] } ],\n [ 'I', 'B', 'iii', {} ],\n [ 'II', 'A', 'i', { 'datum1': [ 1, 2 ], 'datum2': [ 3, 4 ] } ]\n ]\n\nThis function is strict: \"depth\" must be a non-negative integer and \"obj\" must\nbe a non-null object with at least \"depth\" levels of nesting under all keys.\n\n\n### flattenIter(obj, depth, func)\n\nThis is similar to `flattenObject` except that instead of returning an array,\nthis function invokes `func(entry)` for each `entry` in the array that\n`flattenObject` would return. `flattenIter(obj, depth, func)` is logically\nequivalent to `flattenObject(obj, depth).forEach(func)`. Importantly, this\nversion never constructs the full array. Its memory usage is O(depth) rather\nthan O(n) (where `n` is the number of flattened elements).\n\nThere's another difference between `flattenObject` and `flattenIter` that's\nrelated to the special case where `depth === 0`. In this case, `flattenObject`\nomits the array wrapping `obj` (which is regrettable).\n\n\n### pluck(obj, key)\n\nFetch nested property \"key\" from object \"obj\", traversing objects as needed.\nFor example, `pluck(obj, \"foo.bar.baz\")` is roughly equivalent to\n`obj.foo.bar.baz`, except that:\n\n1. If traversal fails, the resulting value is undefined, and no error is\n thrown. For example, `pluck({}, \"foo.bar\")` is just undefined.\n2. If \"obj\" has property \"key\" directly (without traversing), the\n corresponding property is returned. For example,\n `pluck({ 'foo.bar': 1 }, 'foo.bar')` is 1, not undefined. This is also\n true recursively, so `pluck({ 'a': { 'foo.bar': 1 } }, 'a.foo.bar')` is\n also 1, not undefined.\n\n\n### randElt(array)\n\nReturns an element from \"array\" selected uniformly at random. If \"array\" is\nempty, throws an Error.\n\n\n### startsWith(str, prefix)\n\nReturns true if the given string starts with the given prefix and false\notherwise.\n\n\n### endsWith(str, suffix)\n\nReturns true if the given string ends with the given suffix and false\notherwise.\n\n\n### parseInteger(str, options)\n\nParses the contents of `str` (a string) as an integer. On success, the integer\nvalue is returned (as a number). On failure, an error is **returned** describing\nwhy parsing failed.\n\nBy default, leading and trailing whitespace characters are not allowed, nor are\ntrailing characters that are not part of the numeric representation. This\nbehaviour can be toggled by using the options below. The empty string (`''`) is\nnot considered valid input. If the return value cannot be precisely represented\nas a number (i.e., is smaller than `Number.MIN_SAFE_INTEGER` or larger than\n`Number.MAX_SAFE_INTEGER`), an error is returned. Additionally, the string\n`'-0'` will be parsed as the integer `0`, instead of as the IEEE floating point\nvalue `-0`.\n\nThis function accepts both upper and lowercase characters for digits, similar to\n`parseInt()`, `Number()`, and [strtol(3C)](https://illumos.org/man/3C/strtol).\n\nThe following may be specified in `options`:\n\nOption | Type | Default | Meaning\n------------------ | ------- | ------- | ---------------------------\nbase | number | 10 | numeric base (radix) to use, in the range 2 to 36\nallowSign | boolean | true | whether to interpret any leading `+` (positive) and `-` (negative) characters\nallowImprecise | boolean | false | whether to accept values that may have lost precision (past `MAX_SAFE_INTEGER` or below `MIN_SAFE_INTEGER`)\nallowPrefix | boolean | false | whether to interpret the prefixes `0b` (base 2), `0o` (base 8), `0t` (base 10), or `0x` (base 16)\nallowTrailing | boolean | false | whether to ignore trailing characters\ntrimWhitespace | boolean | false | whether to trim any leading or trailing whitespace/line terminators\nleadingZeroIsOctal | boolean | false | whether a leading zero indicates octal\n\nNote that if `base` is unspecified, and `allowPrefix` or `leadingZeroIsOctal`\nare, then the leading characters can change the default base from 10. If `base`\nis explicitly specified and `allowPrefix` is true, then the prefix will only be\naccepted if it matches the specified base. `base` and `leadingZeroIsOctal`\ncannot be used together.\n\n**Context:** It's tricky to parse integers with JavaScript's built-in facilities\nfor several reasons:\n\n- `parseInt()` and `Number()` by default allow the base to be specified in the\n input string by a prefix (e.g., `0x` for hex).\n- `parseInt()` allows trailing nonnumeric characters.\n- `Number(str)` returns 0 when `str` is the empty string (`''`).\n- Both functions return incorrect values when the input string represents a\n valid integer outside the range of integers that can be represented precisely.\n Specifically, `parseInt('9007199254740993')` returns 9007199254740992.\n- Both functions always accept `-` and `+` signs before the digit.\n- Some older JavaScript engines always interpret a leading 0 as indicating\n octal, which can be surprising when parsing input from users who expect a\n leading zero to be insignificant.\n\nWhile each of these may be desirable in some contexts, there are also times when\nnone of them are wanted. `parseInteger()` grants greater control over what\ninput's permissible.\n\n### iso8601(date)\n\nConverts a Date object to an ISO8601 date string of the form\n\"YYYY-MM-DDTHH:MM:SS.sssZ\". This format is not customizable.\n\n\n### parseDateTime(str)\n\nParses a date expressed as a string, as either a number of milliseconds since\nthe epoch or any string format that Date accepts, giving preference to the\nformer where these two sets overlap (e.g., strings containing small numbers).\n\n\n### hrtimeDiff(timeA, timeB)\n\nGiven two hrtime readings (as from Node's `process.hrtime()`), where timeA is\nlater than timeB, compute the difference and return that as an hrtime. It is\nillegal to invoke this for a pair of times where timeB is newer than timeA.\n\n### hrtimeAdd(timeA, timeB)\n\nAdd two hrtime intervals (as from Node's `process.hrtime()`), returning a new\nhrtime interval array. This function does not modify either input argument.\n\n\n### hrtimeAccum(timeA, timeB)\n\nAdd two hrtime intervals (as from Node's `process.hrtime()`), storing the\nresult in `timeA`. This function overwrites (and returns) the first argument\npassed in.\n\n\n### hrtimeNanosec(timeA), hrtimeMicrosec(timeA), hrtimeMillisec(timeA)\n\nThis suite of functions converts a hrtime interval (as from Node's\n`process.hrtime()`) into a scalar number of nanoseconds, microseconds or\nmilliseconds. Results are truncated, as with `Math.floor()`.\n\n\n### validateJsonObject(schema, object)\n\nUses JSON validation (via JSV) to validate the given object against the given\nschema. On success, returns null. On failure, *returns* (does not throw) a\nuseful Error object.\n\n\n### extraProperties(object, allowed)\n\nCheck an object for unexpected properties. Accepts the object to check, and an\narray of allowed property name strings. If extra properties are detected, an\narray of extra property names is returned. If no properties other than those\nin the allowed list are present on the object, the returned array will be of\nzero length.\n\n### mergeObjects(provided, overrides, defaults)\n\nMerge properties from objects \"provided\", \"overrides\", and \"defaults\". The\nintended use case is for functions that accept named arguments in an \"args\"\nobject, but want to provide some default values and override other values. In\nthat case, \"provided\" is what the caller specified, \"overrides\" are what the\nfunction wants to override, and \"defaults\" contains default values.\n\nThe function starts with the values in \"defaults\", overrides them with the\nvalues in \"provided\", and then overrides those with the values in \"overrides\".\nFor convenience, any of these objects may be falsey, in which case they will be\nignored. The input objects are never modified, but properties in the returned\nobject are not deep-copied.\n\nFor example:\n\n mergeObjects(undefined, { 'objectMode': true }, { 'highWaterMark': 0 })\n\nreturns:\n\n { 'objectMode': true, 'highWaterMark': 0 }\n\nFor another example:\n\n mergeObjects(\n { 'highWaterMark': 16, 'objectMode': 7 }, /* from caller */\n { 'objectMode': true }, /* overrides */\n { 'highWaterMark': 0 }); /* default */\n\nreturns:\n\n { 'objectMode': true, 'highWaterMark': 16 }\n\n\n# Contributing\n\nSee separate [contribution guidelines](CONTRIBUTING.md).\n",
|
|
"readmeFilename": "README.md",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git://github.com/joyent/node-jsprim.git"
|
|
},
|
|
"scripts": {},
|
|
"version": "1.4.1"
|
|
}
|