Socket
Socket
Sign inDemoInstall

items

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

items - npm Package Compare versions

Comparing version 2.1.2 to 2.2.1

LICENSE.md

5

lib/index.js
'use strict';
// Load modules
// Declare internals
const internals = {};

@@ -9,0 +4,0 @@

16

package.json
{
"name": "items",
"description": "Bare minimum async methods",
"version": "2.1.2",
"version": "2.2.1",
"repository": "git://github.com/hapijs/items",
"engines": {
"node": ">=6.0.0"
},
"main": "lib/index.js",

@@ -12,12 +15,15 @@ "keywords": [

],
"files": [
"lib"
],
"dependencies": {},
"devDependencies": {
"code": "4.x.x",
"lab": "13.x.x"
"lab": "14.x.x"
},
"scripts": {
"test": "lab -a code -t 100 -L -I SharedArrayBuffer,Atomics",
"test-cov-html": "lab -a code -r html -o coverage.html -I SharedArrayBuffer,Atomics"
"test": "lab -a code -t 100 -L -l",
"test-cov-html": "lab -a code -r html -o coverage.html -l"
},
"license": "BSD-3-Clause"
"license": "SEE LICENSE IN LICENSE.md"
}

@@ -1,44 +0,20 @@

#items
<a href="https://hapi.dev"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a>
Bare minimum async methods adapted specifically for the very limited **hapi** core use cases. Use
[async](https://github.com/caolan/async) for all your application needs.
# items
[![Build Status](https://secure.travis-ci.org/hapijs/items.png)](http://travis-ci.org/hapijs/items)
## License
Lead Maintainer - [Eran Hammer](https://github.com/hueniverse)
This package requires a commercial license. You may not use, copy, or distribute it without first acquiring a commercial license from Sideway Inc. Using this software without a license is a violation of US and international law. For more information about available licenses please check https://hapi.dev/support.
## `Items.serial(items, method, callback)`
#### Bare minimum async methods adapted specifically for the very limited **hapi** core use cases.
Runs `method` against each value in the `items` array *in series*. `callback` is executed when all of the tasks are complete. Calling back with an error will short-circuit the remaining tasks.
**items** is part of the **hapi** ecosystem and was designed to work seamlessly with the [hapi web framework](https://hapi.dev) and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out [hapi](https://hapi.dev) – they work even better together.
- `items` an array of items to pass to `method`.
- `method` a function with the signature `function (item, next, i)`.
- `item` - is the currently processing item in the `items` array.
- `next` - callback function to indicate the end of processing for `item`. Calling `next` with a truthy parameter indicates an error and ends `Items.serial`.
- `i` - The current item's index in the `items` array.
- `callback` - a function with the signature `function (err)`.
- `err` - indicates any errors during processing.
### Visit the [hapi.dev](https://hapi.dev) Developer Portal for tutorials, documentation, and support
## `Items.parallel(items, method, callback)`
## Useful resources
Runs `method` against each value in the `items` array *in parallel*. `callback` is executed when all of the tasks are complete. Calling back with an error will short-circuit the remaining tasks.
- `items` an array of items to pass to `method`.
- `method` a function with the signature `function (item, next, i)`.
- `item` - is the currently processing item in the `items` array.
- `next` - callback function to indicate the end of processing for `item`. Calling `next` with a truthy parameter indicates an error and ends `Items.parallel`.
- `i` - The current item's index in the `items` array.
- `callback` - a function with the signature `function (err)`.
- `err` - indicates any errors during processing.
## `Items.parallel.execute(tasks, callback)`
Runs all of the functions in `tasks` *in parallel* and stores the results in a collector object passed into `callback`. If any of the tasks callback with an error, the collector object is `null`.
- `tasks` - on object containing functions to execute in parallel. The `key` of the function is the `key` in the result of collector object. The task should have the signature `function (next)`
- `next(err, result)` - callback function to indicate the end of processing for the current task.
- `err` - indicates any errors during processing.
- `result` - result of this function. This value will be set on the collector object in the final callback.
- `callback(err, result)`
- `err` - any errors reported by *any* of the `tasks`.
- `result` - an object containing the result of running all of the `tasks`. `result` will be `null` if any of the tasks callback with an error. The `result.key` will be the corresponding `key` of the `tasks` object.
- [Documentation and API](https://hapi.dev/family/items/)
- [Version status](https://hapi.dev/resources/status/#items) (builds, dependencies, node versions, licenses, eol)
- [Project policies](https://hapi.dev/policies/)
- [Free and commercial support options](https://hapi.dev/support/)
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