New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

yaku

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaku - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

63

lib/yaku.js
/*
Yaku v0.3.0
Yaku v0.3.1
(c) 2015 Yad Smood. http://ysmood.org

@@ -12,2 +12,4 @@ License MIT

$nil = void 0;
root = typeof global === 'object' ? global : window;

@@ -271,2 +273,19 @@

/**
* Only Node has `process.nextTick` function. For browser there are
* so many ways to polyfill it. Yaku won't do it for you, instead you
* can choose what you prefer. For example, this project
* [setImmediate](https://github.com/YuzuJS/setImmediate).
* By default, Yaku will use `process.nextTick` on Node, `setTimeout` on browser.
* @type {Function}
* @example
* ```coffee
* Promise = require 'yaku'
* Promise.nextTick = window.setImmediate
* ```
*/
Yaku.nextTick = $nil;
/*

@@ -285,4 +304,2 @@ * All static variable name will begin with `$`. Such as `$rejected`.

$nil = void 0;
isObject = function(obj) {

@@ -355,3 +372,3 @@ return typeof obj === 'object';

*/
var flush, fnQueue, fnQueueLen, scheduleFlush;
var flush, fnQueue, fnQueueLen;
fnQueue = Array(initQueueSize);

@@ -385,29 +402,7 @@ fnQueueLen = 0;

*/
scheduleFlush = (function() {
var content, doc, mutationObserver, nextTick, node, observer;
doc = root.document;
Yaku.nextTick = (function() {
try {
nextTick = root.process.nextTick;
return function() {
nextTick(flush);
};
} catch (_error) {}
if (nextTick = root.setImmediate) {
return function() {
nextTick(flush);
};
} else if (mutationObserver = root.MutationObserver) {
content = 1;
node = doc.createTextNode('');
observer = new mutationObserver(flush);
observer.observe(node, {
characterData: true
});
return function() {
node.data = (content = -content);
};
} else {
return function() {
setTimeout(flush);
};
return root.process.nextTick;
} catch (_error) {
return setTimeout;
}

@@ -419,3 +414,3 @@ })();

if (fnQueueLen === 2) {
scheduleFlush();
Yaku.nextTick(flush);
}

@@ -557,3 +552,3 @@ };

scheduleHandler = genScheduler(1000, function(p1, p2) {
scheduleHandler = genScheduler(999, function(p1, p2) {
var handler, x;

@@ -573,3 +568,3 @@ handler = p1._state ? p2._onFulfilled : p2._onRejected;

scheduleUnhandledRejection = genScheduler(100, function(p) {
scheduleUnhandledRejection = genScheduler(9, genScheduler(9, function(p) {
var iter;

@@ -593,3 +588,3 @@ iter = function(node) {

}
});
}));

@@ -596,0 +591,0 @@ genStackInfo = function(reason, p) {

{
"name": "yaku",
"version": "0.3.0",
"version": "0.3.1",
"description": "An ES6 Promise/A+ implementation that doesn't hurt.",

@@ -5,0 +5,0 @@ "main": "lib/yaku.js",

@@ -8,4 +8,3 @@ <a href="http://promisesaplus.com/">

Yaku is full compatible with ES6's native [Promise][native], but much faster.
Yaku is full compatible with ES6's native [Promise][native], but much faster, and more error friendly.
If you want to learn how Promise works, read the minimum implementation [docs/minPromiseA+.coffee][]. Without comments, it is only 80 lines of code.

@@ -22,3 +21,3 @@ It only implements the `constructor` and `then`. It passed all the tests of [promises-aplus-tests][].

- The minified file is only 3.8KB ([Bluebird][] / 73KB, [ES6-promise][] / 18KB)
- The minified file is only 3.6KB ([Bluebird][] / 73KB, [ES6-promise][] / 18KB)
- 100% compliant with Promise/A+ specs

@@ -69,3 +68,3 @@ - Better performance than the native Promise

| -------------------- | --------- | -------------- | --------- | ------- | --------- |
| Yaku | 872/872 | 283ms | 68ms | ++ | 3.8KB |
| Yaku | 872/872 | 283ms | 68ms | ++ | 3.6KB |
| [Bluebird][] v2.9 | 872/872 | 272ms | 164ms | +++++++ | 73KB |

@@ -108,3 +107,3 @@ | [ES6-promise][] v2.1 | 872/872 | 459ms | 110ms | + | 18KB |

- ### **[constructor(executor)](src/yaku.coffee?source#L29)**
- ### **[constructor(executor)](src/yaku.coffee?source#L31)**

@@ -133,3 +132,3 @@ This class follows the [Promises/A+](https://promisesaplus.com) and

- ### **[then(onFulfilled, onRejected)](src/yaku.coffee?source#L59)**
- ### **[then(onFulfilled, onRejected)](src/yaku.coffee?source#L61)**

@@ -162,3 +161,3 @@ Appends fulfillment and rejection handlers to the promise,

- ### **[catch(onRejected)](src/yaku.coffee?source#L77)**
- ### **[catch(onRejected)](src/yaku.coffee?source#L79)**

@@ -187,3 +186,3 @@ The `catch()` method returns a Promise and deals with rejected cases only.

- ### **[@resolve(value)](src/yaku.coffee?source#L93)**
- ### **[@resolve(value)](src/yaku.coffee?source#L95)**

@@ -208,3 +207,3 @@ The `Promise.resolve(value)` method returns a Promise object that is resolved with the given value.

- ### **[@reject(reason)](src/yaku.coffee?source#L107)**
- ### **[@reject(reason)](src/yaku.coffee?source#L109)**

@@ -226,3 +225,3 @@ The `Promise.reject(reason)` method returns a Promise object that is rejected with the given reason.

- ### **[@race(iterable)](src/yaku.coffee?source#L129)**
- ### **[@race(iterable)](src/yaku.coffee?source#L131)**

@@ -255,3 +254,3 @@ The `Promise.race(iterable)` method returns a promise that resolves or rejects

- ### **[@all(iterable)](src/yaku.coffee?source#L166)**
- ### **[@all(iterable)](src/yaku.coffee?source#L168)**

@@ -285,3 +284,3 @@ The `Promise.all(iterable)` method returns a promise that resolves when

- ### **[@onUnhandledRejection(reason)](src/yaku.coffee?source#L216)**
- ### **[@onUnhandledRejection(reason)](src/yaku.coffee?source#L218)**

@@ -310,3 +309,3 @@ Catch all possibly unhandled rejections. If you want to use specific

- ### **[@enableLongStackTrace](src/yaku.coffee?source#L236)**
- ### **[@enableLongStackTrace](src/yaku.coffee?source#L238)**

@@ -326,4 +325,21 @@ It is used to enable the long stack trace.

- ### **[@nextTick](src/yaku.coffee?source#L255)**
Only Node has `process.nextTick` function. For browser there are
so many ways to polyfill it. Yaku won't do it for you, instead you
can choose what you prefer. For example, this project
[setImmediate](https://github.com/YuzuJS/setImmediate).
By default, Yaku will use `process.nextTick` on Node, `setTimeout` on browser.
- **<u>type</u>**: { _Function_ }
- **<u>example</u>**:
```coffee
Promise = require 'yaku'
Promise.nextTick = window.setImmediate
```
# Utils

@@ -330,0 +346,0 @@

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