Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qq

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qq

A heavy-weight library for promises, based on Q

  • 0.3.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3K
decreased by-54.39%
Maintainers
1
Weekly downloads
 
Created
Source

Provides heavy-weight extensions to the Q API for using asynchronous promises, both in the browser and in CommonJS module systems like NodeJS.

The Q utility module exports all of the Q module's API but additionally provides the following functions.

var Q = require("qq");

step(...functions)

Calls each step function serially, proceeding only when
the promise returned by the previous step is deeply
resolved (see: `deep`), and passes the resolution of the
previous step into the argument or arguments of the
subsequent step.

If a step accepts more than one argument, the resolution
of the previous step is treated as an array and expanded
into the step's respective arguments.

`step` returns a promise for the value eventually
returned by the last step.

delay(timeout, eventually_opt)

Returns a promise for the eventual value after `timeout`
miliseconds have elapsed.  `eventually` may be omitted,
in which case the promise will be resolved to
`undefined`.  If `eventually` is a function, progress
will be made by calling that function and resolving to
the returned value.  Otherwise, `eventually` is treated
as a literal value and resolves the returned promise
directly.

shallow(object)

Takes any value and returns a promise for the
corresponding value after all of its properties have
been resolved.  For arrays, this means that the
resolution is a new array with the corresponding values
for each respective promise of the original array, and
for objects, a new object with the corresponding values
for each property.

deep(object)

Takes any value and returns a promise for the
corresponding value after all of its properties have
been deeply resolved.  Any array or object in the
transitive properties of the given value will be
replaced with a new array or object where all of the
owned properties have been replaced with their
resolution.

reduceLeft(values, callback, basis, this) reduceRight(values, callback, basis, this) reduce(values, callback, basis, this)

The reduce methods all have the signature of `reduce` on
an ECMAScript 5 `Array`, but handle the cases where a
value is a promise and when the return value of the
accumulator is a promise.  In these cases, each reducer
guarantees that progress will be made in a particular
order.

`reduceLeft` guarantees that the callback will be called
on each value and accumulation from left to right after
all previous values and accumulations are fully
resolved.

`reduceRight` works similarly from right to left.

`reduce` is opportunistic and will attempt to accumulate
the resolution of any previous resolutions.  This is
useful when the accumulation function is associative.

The qq module provides a Queue object where infinite promises for values can be dequeued before they are enqueued.

put(value)

Places a value on the queue, resolving the next gotten
promise in order.

get()

Returns a promise for the next value from the queue.  If
more values have been enqueued than dequeued, this value
will already be resolved.

close(reason_opt)

Causes all promises dequeued after all already enqueued
values have been depleted will be rejected for the given
reason.

closed

A promise that, when resolved, indicates that all
enqueued values from before the call to `close` have
been dequeued.

Copyright 2009-2011 Kristopher Michael Kowal MIT License (enclosed)

FAQs

Package last updated on 09 Feb 2012

Did you know?

Socket

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.

Install

Related posts

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