Socket
Socket
Sign inDemoInstall

fibers

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fibers - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4

.npmignore

46

future.js

@@ -43,25 +43,36 @@ "use strict";

// Normalize arguments + pull out a FiberFuture for reuse if possible
var futures = Array.prototype.slice.call(arguments, 0), singleFiberFuture;
for (var ii = 0; ii < futures.length; ++ii) {
if (futures[ii] instanceof Future) {
var futures = [], singleFiberFuture;
for (var ii = 0; ii < arguments.length; ++ii) {
var arg = arguments[ii];
if (arg instanceof Future) {
// Ignore already resolved fibers
if (futures[ii].isResolved()) {
futures.splice(ii, 1);
--ii;
if (arg.isResolved()) {
continue;
}
// Look for fiber reuse
if (!singleFiberFuture && futures[ii] instanceof FiberFuture && !futures[ii].started) {
singleFiberFuture = futures[ii];
futures.splice(ii, 1);
--ii;
if (!singleFiberFuture && arg instanceof FiberFuture && !arg.started) {
singleFiberFuture = arg;
continue;
}
} else if (futures[ii] instanceof Array) {
// Flatten arrays
futures.splice.apply(futures, [ii, 1].concat(futures[ii]));
--ii;
continue;
futures.push(arg);
} else if (arg instanceof Array) {
for (var jj = 0; jj < arg.length; ++jj) {
var aarg = arg[jj];
if (aarg instanceof Future) {
// Ignore already resolved fibers
if (aarg.isResolved()) {
continue;
}
// Look for fiber reuse
if (!singleFiberFuture && aarg instanceof FiberFuture && !aarg.started) {
singleFiberFuture = aarg;
continue;
}
futures.push(aarg);
} else {
throw new Error(aarg+ ' is not a future');
}
}
} else {
throw new Error(futures[ii] + ' is not a future');
throw new Error(arg+ ' is not a future');
}

@@ -251,2 +262,5 @@ }

wait: function() {
if (this.isResolved()) {
return this.get();
}
Future.wait(this);

@@ -253,0 +267,0 @@ return this.get();

{
"name": "fibers",
"version": "0.6.3",
"version": "0.6.4",
"description": "Cooperative multi-tasking for Javascript; or, the closest thing to a thread you'll see in node",

@@ -5,0 +5,0 @@ "keywords": [

@@ -7,38 +7,20 @@ fibers(1) -- Fiber support for v8 and Node

To install `node-fibers` just use `npm`. The exact process depends on your
version of Node, so read below.
### If you're using node < 0.5.2:
It's recommended that you install `node-fibers` globally, as it includes a
wrapper script which you must run in. Furthermore you must install from the 0.5
version of `node-fibers`:
* `npm install -g fibers@0.5`
* Ensure `node-fibers` can be found in your $PATH (this should be true unless
you symlinked `node` somewhere).
* Ensure the global `node_modules` directory is in your $NODE_PATH. You might
have done this when you installed `npm`, but probably didn't. If this is too
difficult you can also just do this:
``NODE_ROOT=$(echo 'console.log(require("path").resolve(process.execPath, "..", ".."))' | node); ln -s $(npm list -g | head -n1)/node_modules/fibers $NODE_ROOT/lib/node/``
### Or if you're using node >= 0.5.2:
### via npm
* `npm install fibers`
* You're done!
### from source
* git clone git://github.com/laverdet/node-fibers.git
* cd node-fibers
* make
### notes
Only Linux, SunOS and OS X environments are supported. Windows support is
totally possible, but I'm not going to do it for you. You may be able to build
this on Windows in cygwin just by messing with the makefiles.
totally possible, but I'm not going to do it for you.
node 0.6.x is required to run this release of `node-fibers`. Older versions of
node (0.4.x) are supported in older releases of node-fibers. See the 0.5.x
branch of `node-fibers` for documentation.
GETTING STARTED
---------------
If you intend to use fibers, be sure to run `node-fibers` instead of `node`
**note: this only applies for node<0.5.2 and node-fibers 0.5.x**. After that
just `require('fibers');` in any Javascript file and you will have fiber
support.
EXAMPLES

@@ -225,7 +207,6 @@ --------

which abstraction is right for you and your project. Included with `node-fibers`
is an implementation of "futures" which is fiber-aware. Usage of this library
is documented below. Other externally-maintained options include
[0ctave/node-sync](https://github.com/0ctave/node-sync) and
[lm1/node-fibers-promise](https://github.com/lm1/node-fibers-promise). However
you **should** feel encouraged to be creative with fibers and build a solution
is an implementation of "futures" which is fiber-aware. Usage of this library
is documented below. There are several other externally-maintained options
which can be found on the [wiki](https://github.com/laverdet/node-fibers/wiki).
You **should** feel encouraged to be creative with fibers and build a solution
which works well with your project. For instance, `Future` is not a good

@@ -232,0 +213,0 @@ abstraction to use if you want to build a generator function (see Fibonacci

Sorry, the diff of this file is not supported yet

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