doc/dump.json
[
{
"__docId__": 0,
"kind": "file",
"static": true,
"variation": null,
"name": "src/github-extended.js",
"memberof": null,
"longname": "src/github-extended.js",
"access": null,
"description": null,
"lineNumber": 1,
"content": "'use strict';\n\nimport GithubApi from 'github-api';\n\n/**\n * The class that extends Github.js\n *\n * @extends GithubApi\n */\nexport\n default class Github extends GithubApi {\n /**\n * @constructor\n * @param {Object} options The object containing the information to work with the GitHub API\n * @param {string} options.username The username used on GitHub\n * @param {string} options.password The password of the GitHub account\n * @param {string} options.auth The type of authentication to use. It can be either `basic` or `oauth`\n * @param {string} options.token The token to access the GitHub API\n */\n constructor(options) {\n super(options);\n\n let superGetRepo = this.getRepo;\n let request = this.request || this._request; // jscs:ignore disallowDanglingUnderscores\n\n /**\n * Returns an object representing a specific repository\n *\n * @param {string} user The username that possesses the repository\n * @param {string} repo The name of the repository to work on\n *\n * @returns {Object}\n */\n this.getRepo = (user, repo) => {\n let repository = superGetRepo(user, repo);\n let superRemove = repository.remove;\n let superFork = repository.fork;\n\n function getRepositoryInfo(repository) {\n return new Promise((resolve, reject) => {\n repository.show((error, repo) => {\n if (error) {\n reject(error);\n }\n\n resolve(repo);\n });\n });\n }\n\n /**\n * Searches files and folders\n *\n * @param {string} string The string to search\n * @param {Object} [options={}] Possible options\n * @param {string} [options.branch] The name of the branch in which the search must be performed\n * @param {boolean} [options.caseSensitive=false] If the search must be case sensitive\n * @param {boolean} [options.excludeFiles=false] If the result must exclude files\n * @param {boolean} [options.excludeFolders=false] If the result must exclude folders\n *\n * @returns {Promise}\n */\n repository.search = (string, options = {}) => {\n const FILE = 'blob';\n const FOLDER = 'tree';\n\n options = Object.assign({\n branch: 'master',\n caseSensitive: false,\n excludeFiles: false,\n excludeFolders: false\n }, options);\n\n return new Promise((resolve, reject) => {\n repository.getSha(options.branch, '', (error, sha) => {\n if (error) {\n reject(error);\n }\n\n resolve(sha);\n });\n })\n .then(sha => {\n return new Promise((resolve, reject) => {\n repository.getTree(`${sha}?recursive=true`, (error, list) => {\n if (error) {\n // No matches\n if (error.error === 404) {\n resolve([]);\n } else {\n reject(error);\n }\n }\n\n resolve(list);\n });\n });\n })\n .then(list => {\n let regex = new RegExp(string, options.caseSensitive ? '' : 'i');\n\n return list.filter(content => {\n let fileCondition = options.excludeFiles ? content.type !== FILE : true;\n let folderCondition = options.excludeFolders ? content.type !== FOLDER : true;\n let extractName = (path) => path.substring(path.lastIndexOf('/') + 1);\n\n return fileCondition && folderCondition && regex.test(extractName(content.path));\n });\n });\n };\n\n /**\n * Merges a pull request\n *\n * @param {Object} pullRequest The pull request to merge\n * @param {Object} [options={}] Possible options\n * @param {string} [options.commitMessage] The commit message for the merge\n *\n * @returns {Promise}\n */\n repository.mergePullRequest = (pullRequest, options = {}) => {\n options = Object.assign(\n {\n commitMessage: `Merged pull request gh-${pullRequest.number}`\n },\n options\n );\n\n return getRepositoryInfo(repository)\n .then(repositoryInfo => {\n return new Promise((resolve, reject) => {\n request(\n 'PUT',\n `/repos/${repositoryInfo.full_name}/pulls/${pullRequest.number}/merge`, // jscs:ignore\n {\n commit_message: options.commitMessage, // jscs:ignore\n sha: pullRequest.head.sha\n },\n (error, mergeInfo) => {\n if (error) {\n reject(error);\n }\n\n resolve(mergeInfo);\n }\n );\n });\n });\n };\n\n /**\n * Deletes a file or a folder and all of its content from a given branch\n *\n * @param {string} [branchName='master'] The name of the branch in which the deletion must be performed\n * @param {string} [path=''] The path of the file or the folder to delete\n *\n * @returns {Promise}\n */\n repository.remove = (branchName = 'master', path = '') => {\n function removeFile(branchName, path) {\n return new Promise((resolve, reject) => {\n superRemove(branchName, path, error => {\n if (error) {\n reject(error);\n }\n\n resolve();\n });\n });\n }\n\n function removeFolder() {\n return new Promise((resolve, reject) => {\n repository.getRef(`heads/${branchName}`, (error, sha) => {\n if (error) {\n reject(error);\n }\n\n resolve(sha);\n });\n })\n .then(sha => {\n return new Promise((resolve, reject) => {\n repository.getTree(`${sha}?recursive=true`, (error, tree) => {\n if (error) {\n reject(error);\n }\n\n resolve(tree);\n });\n });\n })\n .then(tree => {\n let filesPromises = Promise.resolve();\n\n // Filters all items that aren't in the path of interest and aren't files\n // and delete them.\n tree\n .filter(item => item.path.indexOf(path) === 0 && item.type === 'blob')\n .map(item => item.path)\n .forEach(path => {\n filesPromises = filesPromises.then(() => removeFile(branchName, path));\n });\n\n return filesPromises;\n });\n }\n\n // Remove any trailing slash from the path.\n // GitHub does not accept it even when dealing with folders.\n path = path.replace(/\\/$/, '');\n\n let removeFilePromise = removeFile(branchName, path);\n\n return removeFilePromise\n .then(\n () => removeFilePromise,\n error => {\n // If the operation fails because the path specified is that of a folder\n // keep going to retrieve the files recursively\n if (error.error !== 422) {\n throw error;\n }\n\n return removeFolder();\n });\n };\n\n /**\n * Creates a fork of the repository\n *\n * @returns {Promise}\n */\n repository.fork = () => {\n return new Promise((resolve, reject) => {\n superFork((err, forkInfo) => {\n function pollFork(fork) {\n fork.contents('master', '', (err, contents) => {\n if (contents) {\n resolve(forkInfo);\n } else {\n setTimeout(pollFork.bind(null, fork), 250);\n }\n });\n }\n\n if (err) {\n reject(err);\n } else {\n pollFork(superGetRepo(options.username, repo));\n }\n });\n });\n };\n\n return repository;\n };\n }\n}"
},
{
"__docId__": 1,
"kind": "class",
"static": true,
"variation": null,
"name": "Github",
"memberof": "src/github-extended.js",
"longname": "src/github-extended.js~Github",
"access": null,
"export": true,
"importPath": "github-extended",
"importStyle": "Github",
"description": "The class that extends Github.js",
"lineNumber": 11,
"interface": false,
"extends": [
"*"
]
},
{
"__docId__": 2,
"kind": "constructor",
"static": false,
"variation": null,
"name": "constructor",
"memberof": "src/github-extended.js~Github",
"longname": "src/github-extended.js~Github#constructor",
"access": null,
"description": null,
"lineNumber": 20,
"unknown": [
{
"tagName": "@constructor",
"tagValue": ""
}
],
"params": [
{
"nullable": null,
"types": [
"Object"
],
"spread": false,
"optional": false,
"name": "options",
"description": "The object containing the information to work with the GitHub API"
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "options.username",
"description": "The username used on GitHub"
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "options.password",
"description": "The password of the GitHub account"
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "options.auth",
"description": "The type of authentication to use. It can be either `basic` or `oauth`"
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "options.token",
"description": "The token to access the GitHub API"
}
],
"generator": false
},
{
"__docId__": 3,
"kind": "member",
"static": false,
"variation": null,
"name": "getRepo",
"memberof": "src/github-extended.js~Github",
"longname": "src/github-extended.js~Github#getRepo",
"access": null,
"description": "Returns an object representing a specific repository",
"lineNumber": 34,
"unknown": [
{
"tagName": "@returns",
"tagValue": "{Object}"
}
],
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "user",
"description": "The username that possesses the repository"
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "repo",
"description": "The name of the repository to work on"
}
],
"return": {
"nullable": null,
"types": [
"Object"
],
"spread": false,
"description": ""
},
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 5,
"kind": "external",
"static": true,
"variation": null,
"name": "Infinity",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Infinity",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 6,
"kind": "external",
"static": true,
"variation": null,
"name": "NaN",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~NaN",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 7,
"kind": "external",
"static": true,
"variation": null,
"name": "undefined",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~undefined",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 8,
"kind": "external",
"static": true,
"variation": null,
"name": "null",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~null",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 9,
"kind": "external",
"static": true,
"variation": null,
"name": "Object",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Object",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 10,
"kind": "external",
"static": true,
"variation": null,
"name": "object",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~object",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 11,
"kind": "external",
"static": true,
"variation": null,
"name": "Function",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Function",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 12,
"kind": "external",
"static": true,
"variation": null,
"name": "function",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~function",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 13,
"kind": "external",
"static": true,
"variation": null,
"name": "Boolean",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Boolean",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 14,
"kind": "external",
"static": true,
"variation": null,
"name": "boolean",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~boolean",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 15,
"kind": "external",
"static": true,
"variation": null,
"name": "Symbol",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Symbol",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 16,
"kind": "external",
"static": true,
"variation": null,
"name": "Error",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Error",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 17,
"kind": "external",
"static": true,
"variation": null,
"name": "EvalError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~EvalError",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 18,
"kind": "external",
"static": true,
"variation": null,
"name": "InternalError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~InternalError",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 19,
"kind": "external",
"static": true,
"variation": null,
"name": "RangeError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~RangeError",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 20,
"kind": "external",
"static": true,
"variation": null,
"name": "ReferenceError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~ReferenceError",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 21,
"kind": "external",
"static": true,
"variation": null,
"name": "SyntaxError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~SyntaxError",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 22,
"kind": "external",
"static": true,
"variation": null,
"name": "TypeError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~TypeError",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 23,
"kind": "external",
"static": true,
"variation": null,
"name": "URIError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~URIError",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 24,
"kind": "external",
"static": true,
"variation": null,
"name": "Number",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Number",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 25,
"kind": "external",
"static": true,
"variation": null,
"name": "number",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~number",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 26,
"kind": "external",
"static": true,
"variation": null,
"name": "Date",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Date",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 27,
"kind": "external",
"static": true,
"variation": null,
"name": "String",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~String",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 28,
"kind": "external",
"static": true,
"variation": null,
"name": "string",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~string",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 29,
"kind": "external",
"static": true,
"variation": null,
"name": "RegExp",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~RegExp",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 30,
"kind": "external",
"static": true,
"variation": null,
"name": "Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Array",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 31,
"kind": "external",
"static": true,
"variation": null,
"name": "Int8Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Int8Array",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 32,
"kind": "external",
"static": true,
"variation": null,
"name": "Uint8Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Uint8Array",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 33,
"kind": "external",
"static": true,
"variation": null,
"name": "Uint8ClampedArray",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Uint8ClampedArray",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 34,
"kind": "external",
"static": true,
"variation": null,
"name": "Int16Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Int16Array",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 35,
"kind": "external",
"static": true,
"variation": null,
"name": "Uint16Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Uint16Array",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 36,
"kind": "external",
"static": true,
"variation": null,
"name": "Int32Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Int32Array",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 37,
"kind": "external",
"static": true,
"variation": null,
"name": "Uint32Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Uint32Array",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 38,
"kind": "external",
"static": true,
"variation": null,
"name": "Float32Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Float32Array",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 39,
"kind": "external",
"static": true,
"variation": null,
"name": "Float64Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Float64Array",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 40,
"kind": "external",
"static": true,
"variation": null,
"name": "Map",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Map",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 41,
"kind": "external",
"static": true,
"variation": null,
"name": "Set",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Set",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 42,
"kind": "external",
"static": true,
"variation": null,
"name": "WeakMap",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~WeakMap",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 43,
"kind": "external",
"static": true,
"variation": null,
"name": "WeakSet",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~WeakSet",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 44,
"kind": "external",
"static": true,
"variation": null,
"name": "ArrayBuffer",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~ArrayBuffer",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 45,
"kind": "external",
"static": true,
"variation": null,
"name": "DataView",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~DataView",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 46,
"kind": "external",
"static": true,
"variation": null,
"name": "JSON",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~JSON",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 47,
"kind": "external",
"static": true,
"variation": null,
"name": "Promise",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Promise",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 48,
"kind": "external",
"static": true,
"variation": null,
"name": "Generator",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Generator",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 49,
"kind": "external",
"static": true,
"variation": null,
"name": "GeneratorFunction",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~GeneratorFunction",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 50,
"kind": "external",
"static": true,
"variation": null,
"name": "Reflect",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Reflect",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 51,
"kind": "external",
"static": true,
"variation": null,
"name": "Proxy",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy",
"memberof": "BuiltinExternal/ECMAScriptExternal.js",
"longname": "BuiltinExternal/ECMAScriptExternal.js~Proxy",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 53,
"kind": "external",
"static": true,
"variation": null,
"name": "CanvasRenderingContext2D",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D",
"memberof": "BuiltinExternal/WebAPIExternal.js",
"longname": "BuiltinExternal/WebAPIExternal.js~CanvasRenderingContext2D",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 54,
"kind": "external",
"static": true,
"variation": null,
"name": "DocumentFragment",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment",
"memberof": "BuiltinExternal/WebAPIExternal.js",
"longname": "BuiltinExternal/WebAPIExternal.js~DocumentFragment",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 55,
"kind": "external",
"static": true,
"variation": null,
"name": "Element",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/Element",
"memberof": "BuiltinExternal/WebAPIExternal.js",
"longname": "BuiltinExternal/WebAPIExternal.js~Element",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 56,
"kind": "external",
"static": true,
"variation": null,
"name": "Event",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/Event",
"memberof": "BuiltinExternal/WebAPIExternal.js",
"longname": "BuiltinExternal/WebAPIExternal.js~Event",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 57,
"kind": "external",
"static": true,
"variation": null,
"name": "Node",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/Node",
"memberof": "BuiltinExternal/WebAPIExternal.js",
"longname": "BuiltinExternal/WebAPIExternal.js~Node",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 58,
"kind": "external",
"static": true,
"variation": null,
"name": "NodeList",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/NodeList",
"memberof": "BuiltinExternal/WebAPIExternal.js",
"longname": "BuiltinExternal/WebAPIExternal.js~NodeList",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 59,
"kind": "external",
"static": true,
"variation": null,
"name": "XMLHttpRequest",
"externalLink": "https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest",
"memberof": "BuiltinExternal/WebAPIExternal.js",
"longname": "BuiltinExternal/WebAPIExternal.js~XMLHttpRequest",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 60,
"kind": "external",
"static": true,
"variation": null,
"name": "AudioContext",
"externalLink": "https://developer.mozilla.org/en/docs/Web/API/AudioContext",
"memberof": "BuiltinExternal/WebAPIExternal.js",
"longname": "BuiltinExternal/WebAPIExternal.js~AudioContext",
"access": null,
"description": null,
"builtinExternal": true
},
{
"__docId__": 61,
"kind": "testFile",
"static": true,
"variation": null,
"name": "test/spec/test.js",
"memberof": null,
"longname": "test/spec/test.js",
"access": null,
"description": null,
"lineNumber": 1,
"content": "'use strict';\n\nimport Github from '../../src/github-extended';\nimport testUser from '../fixtures/user.json';\n\n/** @test {Github} */\ndescribe('Github', () => {\n let github, repository, testRepositoryName;\n\n function promisifiedWrite(data) {\n return new Promise((resolve, reject) => {\n data.repository.write(data.branch, data.filename, data.content, data.commitMessage, error => {\n if (error) {\n reject(error);\n }\n\n resolve();\n });\n });\n }\n\n /**\n * Delete one or more repositories\n *\n * @param {string|Array} repository\n *\n * @returns {Promise}\n */\n function deleteRepository(repository) {\n if (typeof repository === 'string') {\n repository = [repository];\n }\n\n let repositoriesPromises = repository.map(name => {\n return new Promise((resolve, reject) => {\n github\n .getRepo(testUser.username, name)\n .deleteRepo((error, result) => {\n if (error) {\n reject(error);\n }\n\n resolve(result);\n });\n })\n });\n\n return Promise.all(repositoriesPromises);\n }\n\n before(done => {\n github = new Github({\n username: testUser.username,\n password: testUser.password,\n auth: 'basic'\n });\n let user = github.getUser();\n\n testRepositoryName = 'github-extended-' + Math.floor(Math.random() * 100000);\n user.createRepo({\n name: testRepositoryName\n },\n error => {\n if (error) {\n throw error;\n }\n\n repository = github.getRepo(testUser.username, testRepositoryName);\n promisifiedWrite({\n repository: repository,\n branch: 'master',\n filename: 'README.md',\n content: '# GitHub Extended',\n commitMessage: 'Initial commit'\n })\n .then(() => done());\n }\n );\n repository = github.getRepo(testUser.username, testRepositoryName);\n });\n\n after(done => repository.deleteRepo(() => done()));\n\n describe('search()', () => {\n let branchName = 'search';\n let files = [\n 'package.json',\n 'Hello world.md',\n 'README.md',\n 'app/index.html',\n 'app/scripts/main.js'\n ];\n\n before(done => {\n repository.branch('master', branchName, error => {\n if (error) {\n throw error;\n }\n\n let promise = Promise.resolve();\n\n files.forEach(file => {\n promise = promise.then(() => {\n return promisifiedWrite({\n repository: repository,\n branch: branchName,\n filename: file,\n content: 'THIS IS A TEST',\n commitMessage: 'Commit message'\n });\n });\n });\n\n promise.then(() => done());\n });\n });\n\n it('should find matches with the default configuration', () => {\n let search = repository.search('PAC', {\n branch: branchName\n });\n let results = search.then(result => {\n return result.map(item => {\n return {\n type: item.type,\n path: item.path\n };\n });\n });\n\n return Promise.all([\n assert.eventually.isArray(search, 'An array is returned'),\n assert.eventually.lengthOf(search, 1, 'One file found'),\n assert.eventually.sameDeepMembers(\n results,\n [{\n type: 'blob',\n path: 'package.json'\n }],\n 'Correct information returned'\n )\n ]);\n });\n\n it('should find matches with the caseSensitive option', () => {\n let search = repository.search('acka', {\n branch: branchName,\n caseSensitive: true\n });\n let results = search.then(result => {\n return result.map(item => {\n return {\n type: item.type,\n path: item.path\n };\n });\n });\n\n return Promise.all([\n assert.eventually.isArray(search, 'An array is returned'),\n assert.eventually.lengthOf(search, 1, 'One file found'),\n assert.eventually.sameDeepMembers(\n results,\n [{\n type: 'blob',\n path: 'package.json'\n }],\n 'Correct information returned'\n )\n ]);\n });\n\n it('should find only files with the excludeFolders option', () => {\n let search = repository.search('PAC', {\n branch: branchName,\n excludeFolders: true\n });\n let results = search.then(result => {\n return result.map(item => {\n return {\n type: item.type,\n path: item.path\n };\n });\n });\n\n return Promise.all([\n assert.eventually.isArray(search, 'An array is returned'),\n assert.eventually.lengthOf(search, 1, 'One file found'),\n assert.eventually.sameDeepMembers(\n results,\n [{\n type: 'blob',\n path: 'package.json'\n }],\n 'Correct information returned'\n )\n ]);\n });\n\n it('should find only folders with the excludeFolders option', () => {\n let search = repository.search('app', {\n branch: branchName,\n excludeFiles: true\n });\n let results = search.then(result => {\n return result.map(item => {\n return {\n type: item.type,\n path: item.path\n };\n });\n });\n\n return Promise.all([\n assert.eventually.isArray(search, 'An array is returned'),\n assert.eventually.lengthOf(search, 1, 'One folder found'),\n assert.eventually.sameDeepMembers(\n results,\n [{\n type: 'tree',\n path: 'app'\n }],\n 'Correct information returned'\n )\n ]);\n });\n\n it('should not find any match with a non-matching string with the default configuration', () => {\n let search = repository.search('random.unknown');\n\n return Promise.all([\n assert.eventually.isArray(search, 'An array is returned'),\n assert.eventually.lengthOf(search, 0, 'Zero files found')\n ]);\n });\n });\n\n describe('mergePullRequest()', () => {\n let branchName = 'mergePullRequest';\n let branchIndex = 0;\n let filename = 'index.md';\n let pullRequest;\n\n before(done => {\n repository.branch('master', branchName, error => {\n if (error) {\n throw error;\n }\n\n promisifiedWrite({\n repository: repository,\n branch: branchName,\n filename: filename,\n content: 'This is a text',\n commitMessage: 'Commit'\n })\n .then(() => done());\n });\n });\n\n beforeEach(done => {\n branchIndex++;\n let updatesBranchName = branchName + branchIndex;\n repository.branch(branchName, updatesBranchName, error => {\n if (error) {\n throw error;\n }\n\n promisifiedWrite({\n repository: repository,\n branch: updatesBranchName,\n filename: filename,\n content: 'This is a different text',\n commitMessage: 'Commit message'\n })\n .then(() => {\n repository.createPullRequest({\n title: 'Pull request',\n body: 'Pull request',\n base: branchName,\n head: `${testUser.username}:${updatesBranchName}`\n },\n (error, pullRequestInfo) => {\n if (error) {\n throw error;\n }\n\n pullRequest = pullRequestInfo;\n done();\n }\n );\n });\n });\n });\n\n it('should merge a valid pull request with the default merge commit message', () => {\n let merge = repository.mergePullRequest(pullRequest);\n\n return Promise.all([\n assert.isFulfilled(merge, 'The request is successful'),\n assert.eventually.isObject(merge, 'The information about the merged pull request are returned'),\n assert.eventually.propertyVal(merge, 'merged', true, 'The pull request is merged')\n ]);\n });\n\n it('should merge a valid pull request with a custom merge commit message', () => {\n let options = {\n commitMessage: 'Custom message'\n };\n let merge = repository.mergePullRequest(pullRequest, options);\n\n return Promise.all([\n assert.isFulfilled(merge, 'The request is successful'),\n assert.eventually.isObject(merge, 'The information about the merged pull request are returned'),\n assert.eventually.propertyVal(merge, 'merged', true, 'The pull request is merged')\n ]);\n });\n\n it('should throw an error for an invalid pull request', () => {\n pullRequest.head.sha += 'random-text';\n let merge = repository.mergePullRequest(pullRequest);\n\n return assert.isRejected(merge, 'The pull request is not merged');\n });\n });\n\n describe('remove()', () => {\n let branchName = 'remove';\n let files = [\n 'package.json',\n 'Hello world.md',\n 'README.md',\n 'app/index.html',\n 'app/scripts/main.js'\n ];\n\n function promisifiedGetTree(repository, branchName) {\n return new Promise((resolve, reject) => {\n repository.getRef(`heads/${branchName}`, (error, sha) => {\n if (error) {\n reject(error);\n }\n\n repository.getTree(`${sha}?recursive=true`, (error, tree) => {\n if (error) {\n reject(error);\n }\n\n resolve(tree);\n });\n });\n })\n }\n\n before(done => {\n repository.branch('master', branchName, error => {\n if (error) {\n throw error;\n }\n\n let promise = Promise.resolve();\n\n files.forEach(file => {\n promise = promise.then(() => {\n return promisifiedWrite({\n repository: repository,\n branch: branchName,\n filename: file,\n content: 'THIS IS A TEST',\n commitMessage: 'Commit message'\n });\n });\n });\n\n promise.then(() => done());\n });\n });\n\n it('should delete a file', () => {\n let itemsNumber;\n\n return promisifiedGetTree(repository, branchName)\n .then(tree => itemsNumber = tree.length)\n .then(() => repository.remove(branchName, 'package.json'))\n .then(() => promisifiedGetTree(repository, branchName))\n .then(tree => {\n let readContent = new Promise((resolve, reject) => {\n repository.read(branchName, 'package.json', (error, data) => {\n if (error) {\n reject(error);\n }\n\n resolve(data);\n });\n });\n\n return Promise.all([\n assert.strictEqual(tree.length, itemsNumber - 1, 'The items count is decreased'),\n assert.isRejected(readContent, 'The file is not found')\n ]);\n });\n });\n\n it('should delete a folder and all its content', () => {\n let itemsNumber;\n\n return promisifiedGetTree(repository, branchName)\n .then(tree => itemsNumber = tree.length)\n .then(() => repository.remove(branchName, 'app'))\n .then(() => promisifiedGetTree(repository, branchName))\n .then(tree => {\n let readContent = new Promise((resolve, reject) => {\n repository.contents(branchName, 'app/', (error, contents) => {\n if (error) {\n reject(error);\n }\n\n resolve(contents);\n });\n });\n\n return Promise.all([\n assert.strictEqual(tree.length, itemsNumber - 4, 'The items count is decreased'),\n assert.isRejected(readContent, 'The folder is not found')\n ]);\n });\n });\n });\n\n describe('fork()', () => {\n let forkUsername = 'AurelioDeRosa';\n let forkRepositoryName = 'HTML5-API-demos';\n\n afterEach(done => {\n let fork = github.getRepo(testUser.username, forkRepositoryName);\n\n fork.deleteRepo(() => done());\n });\n\n it('should be able to fork an existent repository', () => {\n let repositoryToFork = github.getRepo(forkUsername, forkRepositoryName);\n let fork = repositoryToFork.fork();\n\n return Promise.all([\n assert.eventually.propertyVal(fork, 'fork', true, 'The repository is a fork'),\n assert.eventually.propertyVal(\n fork,\n 'full_name',\n `${testUser.username}/${forkRepositoryName}`,\n 'The fork is created in the account of the user'\n )\n ]);\n });\n\n it('should throw an error if the repository to fork does not exist', () => {\n let repositoryToFork = github.getRepo(forkUsername, 'non-existent-repository');\n let fork = repositoryToFork.fork();\n\n return assert.isRejected(fork, 'The fork is not created');\n });\n });\n});"
},
{
"__docId__": 62,
"kind": "testDescribe",
"static": true,
"variation": null,
"name": "describe0",
"testId": 0,
"memberof": "test/spec/test.js",
"testDepth": 0,
"longname": "test/spec/test.js~describe0",
"access": null,
"description": "Github",
"lineNumber": 7,
"unknown": [
{
"tagName": "@test",
"tagValue": "{Github}"
}
],
"testTargets": [
"Github"
]
},
{
"__docId__": 63,
"kind": "testDescribe",
"static": true,
"variation": null,
"name": "describe1",
"testId": 1,
"memberof": "test/spec/test.js~describe0",
"testDepth": 1,
"longname": "test/spec/test.js~describe0.describe1",
"access": null,
"description": "search()",
"lineNumber": 84
},
{
"__docId__": 64,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it2",
"testId": 2,
"memberof": "test/spec/test.js~describe0.describe1",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe1.it2",
"access": null,
"description": "should find matches with the default configuration",
"lineNumber": 118
},
{
"__docId__": 65,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it3",
"testId": 3,
"memberof": "test/spec/test.js~describe0.describe1",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe1.it3",
"access": null,
"description": "should find matches with the caseSensitive option",
"lineNumber": 145
},
{
"__docId__": 66,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it4",
"testId": 4,
"memberof": "test/spec/test.js~describe0.describe1",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe1.it4",
"access": null,
"description": "should find only files with the excludeFolders option",
"lineNumber": 173
},
{
"__docId__": 67,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it5",
"testId": 5,
"memberof": "test/spec/test.js~describe0.describe1",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe1.it5",
"access": null,
"description": "should find only folders with the excludeFolders option",
"lineNumber": 201
},
{
"__docId__": 68,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it6",
"testId": 6,
"memberof": "test/spec/test.js~describe0.describe1",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe1.it6",
"access": null,
"description": "should not find any match with a non-matching string with the default configuration",
"lineNumber": 229
},
{
"__docId__": 69,
"kind": "testDescribe",
"static": true,
"variation": null,
"name": "describe7",
"testId": 7,
"memberof": "test/spec/test.js~describe0",
"testDepth": 1,
"longname": "test/spec/test.js~describe0.describe7",
"access": null,
"description": "mergePullRequest()",
"lineNumber": 239
},
{
"__docId__": 70,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it8",
"testId": 8,
"memberof": "test/spec/test.js~describe0.describe7",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe7.it8",
"access": null,
"description": "should merge a valid pull request with the default merge commit message",
"lineNumber": 297
},
{
"__docId__": 71,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it9",
"testId": 9,
"memberof": "test/spec/test.js~describe0.describe7",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe7.it9",
"access": null,
"description": "should merge a valid pull request with a custom merge commit message",
"lineNumber": 307
},
{
"__docId__": 72,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it10",
"testId": 10,
"memberof": "test/spec/test.js~describe0.describe7",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe7.it10",
"access": null,
"description": "should throw an error for an invalid pull request",
"lineNumber": 320
},
{
"__docId__": 73,
"kind": "testDescribe",
"static": true,
"variation": null,
"name": "describe11",
"testId": 11,
"memberof": "test/spec/test.js~describe0",
"testDepth": 1,
"longname": "test/spec/test.js~describe0.describe11",
"access": null,
"description": "remove()",
"lineNumber": 328
},
{
"__docId__": 74,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it12",
"testId": 12,
"memberof": "test/spec/test.js~describe0.describe11",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe11.it12",
"access": null,
"description": "should delete a file",
"lineNumber": 380
},
{
"__docId__": 75,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it13",
"testId": 13,
"memberof": "test/spec/test.js~describe0.describe11",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe11.it13",
"access": null,
"description": "should delete a folder and all its content",
"lineNumber": 405
},
{
"__docId__": 76,
"kind": "testDescribe",
"static": true,
"variation": null,
"name": "describe14",
"testId": 14,
"memberof": "test/spec/test.js~describe0",
"testDepth": 1,
"longname": "test/spec/test.js~describe0.describe14",
"access": null,
"description": "fork()",
"lineNumber": 431
},
{
"__docId__": 77,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it15",
"testId": 15,
"memberof": "test/spec/test.js~describe0.describe14",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe14.it15",
"access": null,
"description": "should be able to fork an existent repository",
"lineNumber": 441
},
{
"__docId__": 78,
"kind": "testIt",
"static": true,
"variation": null,
"name": "it16",
"testId": 16,
"memberof": "test/spec/test.js~describe0.describe14",
"testDepth": 2,
"longname": "test/spec/test.js~describe0.describe14.it16",
"access": null,
"description": "should throw an error if the repository to fork does not exist",
"lineNumber": 456
}
]