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.12.1 to 0.12.2

64

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

@@ -17,2 +17,5 @@ License MIT

, $Symbol = "Symbol"
, $iterator = "iterator"
, $promiseTrace = "_pt"

@@ -80,4 +83,8 @@ , $settlerTrace = "_st"

then: function then (onFulfilled, onRejected) {
if (this.constructor !== Yaku) throw genTypeError($invalid_this);
return addHandler(this, newEmptyYaku(), onFulfilled, onRejected);
return addHandler(
this,
newEmptyPromise(this.constructor),
onFulfilled,
onRejected
);
},

@@ -129,4 +136,3 @@

Yaku.resolve = function resolve (val) {
throwIfNotYaku(this);
return isYaku(val) ? val : settleWithX(newEmptyYaku(), val);
return isYaku(val) ? val : settleWithX(newEmptyPromise(this), val);
};

@@ -145,4 +151,3 @@

Yaku.reject = function reject (reason) {
throwIfNotYaku(this);
return settlePromise(newEmptyYaku(), $rejected, reason);
return settlePromise(newEmptyPromise(this), $rejected, reason);
};

@@ -171,9 +176,7 @@

Yaku.race = function race (iterable) {
throwIfNotYaku(this);
var iter, len, i = 0;
var p = newEmptyYaku(), item;
var p = newEmptyPromise(this), item;
if (isArray(iterable)) {
if (isPlainArray(iterable)) {
len = iterable.length;

@@ -234,5 +237,3 @@ while (i < len) {

Yaku.all = function all (iterable) {
throwIfNotYaku(this);
var p1 = newEmptyYaku()
var p1 = newEmptyPromise(this)
, res = []

@@ -248,3 +249,3 @@ , item

if (isArray(iterable)) {
if (isPlainArray(iterable)) {
len = iterable.length;

@@ -289,3 +290,3 @@ while (countDown < len) {

*/
Yaku.Symbol = root.Symbol || {};
Yaku.Symbol = root[$Symbol] || {};

@@ -371,3 +372,3 @@ /**

, $tryErr = { e: null }
, $noop = {};
, $noop = function () {};

@@ -389,4 +390,6 @@ function extendPrototype (src, target) {

function isArray (obj) {
return obj && typeof obj.length === "number";
function isPlainArray (obj) {
return obj
&& typeof obj.length === "number"
&& !isFunction(obj[Yaku[$Symbol][$iterator]]);
}

@@ -398,6 +401,2 @@

function throwIfNotYaku (obj) {
if (obj !== Yaku) throw genTypeError($invalid_this);
}
/**

@@ -476,3 +475,3 @@ * Wrap a function into a try-catch.

if (obj) {
var gen = obj[Yaku.Symbol.iterator];
var gen = obj[Yaku[$Symbol][$iterator]];
if (isFunction(gen)) {

@@ -558,8 +557,5 @@ return gen.call(obj);

/**
* Create an empty promise.
* @private
* @return {Yaku}
*/
function newEmptyYaku () { return new Yaku($noop); }
function newEmptyPromise (self) {
return new self($noop);
}

@@ -750,3 +746,9 @@ /**

settleXthen(p, x, xthen);
// Fix https://bugs.chromium.org/p/v8/issues/detail?id=4162
if (isYaku(x))
settleXthen(p, x, xthen);
else
Yaku.nextTick(function () {
settleXthen(p, x, xthen);
});
}

@@ -753,0 +755,0 @@ else

{
"name": "yaku",
"version": "0.12.1",
"version": "0.12.2",
"description": "A light-weight ES6 Promises/A+ implementation that doesn't hurt.",

@@ -50,2 +50,3 @@ "main": "lib/yaku.js",

"q": "1.4.1",
"setprototypeof": "1.0.1",
"uglify-js": "2.6.1",

@@ -52,0 +53,0 @@ "webpack": "1.12.13"

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

- ### **[Yaku(executor)](src/yaku.js?source#L28)**
- ### **[Yaku(executor)](src/yaku.js?source#L31)**

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

- ### **[then(onFulfilled, onRejected)](src/yaku.js?source#L73)**
- ### **[then(onFulfilled, onRejected)](src/yaku.js?source#L76)**

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

- ### **[catch(onRejected)](src/yaku.js?source#L94)**
- ### **[catch(onRejected)](src/yaku.js?source#L101)**

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

- ### **[Yaku.resolve(value)](src/yaku.js?source#L121)**
- ### **[Yaku.resolve(value)](src/yaku.js?source#L128)**

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

- ### **[Yaku.reject(reason)](src/yaku.js?source#L136)**
- ### **[Yaku.reject(reason)](src/yaku.js?source#L142)**

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

- ### **[Yaku.race(iterable)](src/yaku.js?source#L161)**
- ### **[Yaku.race(iterable)](src/yaku.js?source#L166)**

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

- ### **[Yaku.all(iterable)](src/yaku.js?source#L223)**
- ### **[Yaku.all(iterable)](src/yaku.js?source#L226)**

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

- ### **[Yaku.Symbol](src/yaku.js?source#L277)**
- ### **[Yaku.Symbol](src/yaku.js?source#L278)**

@@ -367,3 +367,3 @@ The ES6 Symbol object that Yaku should use, by default it will use the

- ### **[Yaku.onUnhandledRejection(reason, p)](src/yaku.js?source#L299)**
- ### **[Yaku.onUnhandledRejection(reason, p)](src/yaku.js?source#L300)**

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

- ### **[Yaku.enableLongStackTrace](src/yaku.js?source#L319)**
- ### **[Yaku.enableLongStackTrace](src/yaku.js?source#L320)**

@@ -413,3 +413,3 @@ It is used to enable the long stack trace.

- ### **[Yaku.nextTick](src/yaku.js?source#L342)**
- ### **[Yaku.nextTick](src/yaku.js?source#L343)**

@@ -439,3 +439,3 @@ Only Node has `process.nextTick` function. For browser there are

- ### **[genIterator(obj)](src/yaku.js?source#L458)**
- ### **[genIterator(obj)](src/yaku.js?source#L457)**

@@ -442,0 +442,0 @@ Generate a iterator

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