\doxysection*{~\newline
  ~\newline
 ~\newline
 }

\begin{quote}
Itty bitty little widdle twinkie pinkie \href{https://people.mozilla.org/~jorendorff/es6-draft.html\#sec-promise-objects}{\texttt{ ES2015 Promise}} implementation \end{quote}
\href{https://travis-ci.org/floatdrop/pinkie}{\texttt{ }} \href{https://coveralls.io/github/floatdrop/pinkie?branch=master}{\texttt{ }}

There are \href{https://github.com/promises-aplus/promises-spec/blob/master/implementations.md\#standalone}{\texttt{ tons of Promise implementations}} out there, but all of them focus on browser compatibility and are often bloated with functionality.

This module is an exact Promise specification polyfill (like \href{https://github.com/getify/native-promise-only}{\texttt{ native-\/promise-\/only}}), but in Node.\+js land (it should be browserify-\/able though).\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20405}{}\doxysubsection{Install}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20405}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install -\/-\/save pinkie }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20406}{}\doxysubsection{Usage}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20406}

\begin{DoxyCode}{0}
\DoxyCodeLine{var fs = require('fs');}
\DoxyCodeLine{var Promise = require('pinkie');}
\DoxyCodeLine{}
\DoxyCodeLine{new Promise(function (resolve, reject) \{}
\DoxyCodeLine{    fs.readFile('foo.json', 'utf8', function (err, data) \{}
\DoxyCodeLine{        if (err) \{}
\DoxyCodeLine{            reject(err);}
\DoxyCodeLine{            return;}
\DoxyCodeLine{        \}}
\DoxyCodeLine{}
\DoxyCodeLine{        resolve(data);}
\DoxyCodeLine{    \});}
\DoxyCodeLine{\});}
\DoxyCodeLine{//=> Promise }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20407}{}\doxysubsubsection{API}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20407}
{\ttfamily pinkie} exports bare \href{https://people.mozilla.org/~jorendorff/es6-draft.html\#sec-promise-objects}{\texttt{ ES2015 Promise}} implementation and polyfills \href{https://nodejs.org/api/process.html\#process_event_unhandledrejection}{\texttt{ Node.\+js rejection events}}. In case you forgot\+:\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20408}{}\doxyparagraph{new Promise(executor)}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20408}
Returns new instance of {\ttfamily Promise}.

\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20409}%
\Hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20409}%
\doxysubparagraph*{executor}

{\itshape Required} ~\newline
 Type\+: {\ttfamily function}

Function with two arguments {\ttfamily resolve} and {\ttfamily reject}. The first argument fulfills the promise, the second argument rejects it.\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20410}{}\doxyparagraph{pinkie.\+all(promises)}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20410}
Returns a promise that resolves when all of the promises in the {\ttfamily promises} Array argument have resolved.\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20411}{}\doxyparagraph{pinkie.\+race(promises)}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20411}
Returns a promise that resolves or rejects as soon as one of the promises in the {\ttfamily promises} Array resolves or rejects, with the value or reason from that promise.\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20412}{}\doxyparagraph{pinkie.\+reject(reason)}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20412}
Returns a Promise object that is rejected with the given {\ttfamily reason}.\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20413}{}\doxyparagraph{pinkie.\+resolve(value)}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20413}
Returns a Promise object that is resolved with the given {\ttfamily value}. If the {\ttfamily value} is a thenable (i.\+e. has a then method), the returned promise will \char`\"{}follow\char`\"{} that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the {\ttfamily value}.\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20414}{}\doxysubsection{Related}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20414}

\begin{DoxyItemize}
\item \href{https://github.com/floatdrop/pinkie-promise}{\texttt{ pinkie-\/promise}} -\/ Returns the native Promise or this module
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_pinkie_readme_autotoc_md20415}{}\doxysubsection{License}\label{md_sfcode_node_modules_pinkie_readme_autotoc_md20415}
MIT © \href{http://github.com/floatdrop}{\texttt{ Vsevolod Strukchinsky}} 