1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00

* first action! (#1)

This commit is contained in:
shimataro 2019-09-18 20:39:54 +09:00 committed by GitHub
parent 8deacc95b1
commit ace1e6a69a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3750 changed files with 1155519 additions and 0 deletions

89
node_modules/es6-promisify/README.md generated vendored Normal file
View file

@ -0,0 +1,89 @@
[![Travis CI](https://travis-ci.org/digitaldesignlabs/es6-promisify.svg)](https://travis-ci.org/digitaldesignlabs/es6-promisify)
# es6-promisify
Converts callback-based functions to Promise-based functions.
## Install
Install with [npm](https://npmjs.org/package/es6-promisify)
```bash
npm install --save es6-promisify
```
## Example
```js
"use strict";
// Declare variables
const promisify = require("es6-promisify");
const fs = require("fs");
// Convert the stat function
const stat = promisify(fs.stat);
// Now usable as a promise!
stat("example.txt").then(function (stats) {
console.log("Got stats", stats);
}).catch(function (err) {
console.error("Yikes!", err);
});
```
## Promisify methods
```js
"use strict";
// Declare variables
const promisify = require("es6-promisify");
const redis = require("redis").createClient(6379, "localhost");
// Create a promise-based version of send_command
const client = promisify(redis.send_command, redis);
// Send commands to redis and get a promise back
client("ping").then(function (pong) {
console.log("Got", pong);
}).catch(function (err) {
console.error("Unexpected error", err);
}).then(function () {
redis.quit();
});
```
## Handle callback multiple arguments
```js
"use strict";
// Declare functions
function test(cb) {
return cb(undefined, 1, 2, 3);
}
// Declare variables
const promisify = require("es6-promisify");
// Create promise-based version of test
const single = promisify(test);
const multi = promisify(test, {multiArgs: true});
// Discards additional arguments
single().then(function (result) {
console.log(result); // 1
});
// Returns all arguments as an array
multi().then(function (result) {
console.log(result); // [1, 2, 3]
});
```
### Tests
Test with nodeunit
```bash
$ npm test
```
Published under the [MIT License](http://opensource.org/licenses/MIT).

73
node_modules/es6-promisify/dist/promise.js generated vendored Normal file
View file

@ -0,0 +1,73 @@
"use strict";
/* global self, window, module, global, require */
module.exports = function () {
"use strict";
var globalObject = void 0;
function isFunction(x) {
return typeof x === "function";
}
// Seek the global object
if (global !== undefined) {
globalObject = global;
} else if (window !== undefined && window.document) {
globalObject = window;
} else {
globalObject = self;
}
// Test for any native promise implementation, and if that
// implementation appears to conform to the specificaton.
// This code mostly nicked from the es6-promise module polyfill
// and then fooled with.
var hasPromiseSupport = function () {
// No promise object at all, and it's a non-starter
if (!globalObject.hasOwnProperty("Promise")) {
return false;
}
// There is a Promise object. Does it conform to the spec?
var P = globalObject.Promise;
// Some of these methods are missing from
// Firefox/Chrome experimental implementations
if (!P.hasOwnProperty("resolve") || !P.hasOwnProperty("reject")) {
return false;
}
if (!P.hasOwnProperty("all") || !P.hasOwnProperty("race")) {
return false;
}
// Older version of the spec had a resolver object
// as the arg rather than a function
return function () {
var resolve = void 0;
var p = new globalObject.Promise(function (r) {
resolve = r;
});
if (p) {
return isFunction(resolve);
}
return false;
}();
}();
// Export the native Promise implementation if it
// looks like it matches the spec
if (hasPromiseSupport) {
return globalObject.Promise;
}
// Otherwise, return the es6-promise polyfill by @jaffathecake.
return require("es6-promise").Promise;
}();

85
node_modules/es6-promisify/dist/promisify.js generated vendored Normal file
View file

@ -0,0 +1,85 @@
"use strict";
/* global module, require */
module.exports = function () {
"use strict";
// Get a promise object. This may be native, or it may be polyfilled
var ES6Promise = require("./promise.js");
/**
* thatLooksLikeAPromiseToMe()
*
* Duck-types a promise.
*
* @param {object} o
* @return {bool} True if this resembles a promise
*/
function thatLooksLikeAPromiseToMe(o) {
return o && typeof o.then === "function" && typeof o.catch === "function";
}
/**
* promisify()
*
* Transforms callback-based function -- func(arg1, arg2 .. argN, callback) -- into
* an ES6-compatible Promise. Promisify provides a default callback of the form (error, result)
* and rejects when `error` is truthy. You can also supply settings object as the second argument.
*
* @param {function} original - The function to promisify
* @param {object} settings - Settings object
* @param {object} settings.thisArg - A `this` context to use. If not set, assume `settings` _is_ `thisArg`
* @param {bool} settings.multiArgs - Should multiple arguments be returned as an array?
* @return {function} A promisified version of `original`
*/
return function promisify(original, settings) {
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var returnMultipleArguments = settings && settings.multiArgs;
var target = void 0;
if (settings && settings.thisArg) {
target = settings.thisArg;
} else if (settings) {
target = settings;
}
// Return the promisified function
return new ES6Promise(function (resolve, reject) {
// Append the callback bound to the context
args.push(function callback(err) {
if (err) {
return reject(err);
}
for (var _len2 = arguments.length, values = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
values[_key2 - 1] = arguments[_key2];
}
if (false === !!returnMultipleArguments) {
return resolve(values[0]);
}
resolve(values);
});
// Call the function
var response = original.apply(target, args);
// If it looks like original already returns a promise,
// then just resolve with that promise. Hopefully, the callback function we added will just be ignored.
if (thatLooksLikeAPromiseToMe(response)) {
resolve(response);
}
});
};
};
}();

73
node_modules/es6-promisify/package.json generated vendored Normal file
View file

@ -0,0 +1,73 @@
{
"_from": "es6-promisify@^5.0.0",
"_id": "es6-promisify@5.0.0",
"_inBundle": false,
"_integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=",
"_location": "/es6-promisify",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "es6-promisify@^5.0.0",
"name": "es6-promisify",
"escapedName": "es6-promisify",
"rawSpec": "^5.0.0",
"saveSpec": null,
"fetchSpec": "^5.0.0"
},
"_requiredBy": [
"/agent-base",
"/socks-proxy-agent/agent-base"
],
"_resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
"_shasum": "5109d62f3e56ea967c4b63505aef08291c8a5203",
"_spec": "es6-promisify@^5.0.0",
"_where": "/home/shimataro/projects/actions/ssh-key-action/node_modules/agent-base",
"author": {
"name": "Mike Hall",
"email": "mikehall314@gmail.com"
},
"bugs": {
"url": "http://github.com/digitaldesignlabs/es6-promisify/issues"
},
"bundleDependencies": false,
"dependencies": {
"es6-promise": "^4.0.3"
},
"deprecated": false,
"description": "Converts callback-based functions to ES6 Promises",
"devDependencies": {
"babel-preset-es2015": "^6.9.0",
"eslint": "^2.13.1",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"nodeunit": "^0.10.0"
},
"files": [
"dist/promisify.js",
"dist/promise.js"
],
"greenkeeper": {
"ignore": [
"eslint"
]
},
"homepage": "https://github.com/digitaldesignlabs/es6-promisify#readme",
"keywords": [
"promises",
"es6",
"promisify"
],
"license": "MIT",
"main": "dist/promisify.js",
"name": "es6-promisify",
"repository": {
"type": "git",
"url": "git+https://github.com/digitaldesignlabs/es6-promisify.git"
},
"scripts": {
"pretest": "./node_modules/eslint/bin/eslint.js ./lib/*.js ./tests/*.js",
"test": "gulp && nodeunit tests"
},
"version": "5.0.0"
}