simple-github-gist-api 2.0.49 → 2.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,10 +44,10 @@ declare class GistFile {
44
44
  *
45
45
  * @param commitId
46
46
  */
47
- private getLatestGistFileFetchUrl;
47
+ private readonly getLatestGistFileFetchUrl;
48
48
  /**
49
49
  * Returns the latest commit of the gist
50
50
  */
51
- private getLatestGistCommit;
51
+ private readonly getLatestGistCommit;
52
52
  }
53
53
  export default GistFile;
@@ -30,16 +30,16 @@ class GistFile {
30
30
  * Save the gist-file
31
31
  */
32
32
  this.save = () => __awaiter(this, void 0, void 0, function* () {
33
- if (this.hasUpdates === false)
33
+ if (!this.hasUpdates)
34
34
  return;
35
35
  const url = `${constants_1.default.githubGists}/${this.gistId}`;
36
36
  const body = {
37
37
  public: this.isPublic,
38
38
  files: {
39
39
  [this.fileName]: {
40
- content: this.fileContent
41
- }
42
- }
40
+ content: this.fileContent,
41
+ },
42
+ },
43
43
  };
44
44
  yield axios_1.default.post(url, body, (0, auth_config_1.default)({ personalAccessToken: this.personalAccessToken }));
45
45
  this.fileHasUpdates = false;
@@ -50,7 +50,8 @@ class GistFile {
50
50
  this.fetchLatest = () => __awaiter(this, void 0, void 0, function* () {
51
51
  const latestCommit = yield this.getLatestGistCommit();
52
52
  const url = this.getLatestGistFileFetchUrl(latestCommit);
53
- this.fileContent = yield axios_1.default.get(url, (0, auth_config_1.default)({ personalAccessToken: this.personalAccessToken }));
53
+ const response = yield axios_1.default.get(url, (0, auth_config_1.default)({ personalAccessToken: this.personalAccessToken }));
54
+ this.fileContent = response.data;
54
55
  this.fileHasUpdates = false;
55
56
  });
56
57
  /**
@@ -59,12 +60,12 @@ class GistFile {
59
60
  * @param commitId
60
61
  */
61
62
  this.getLatestGistFileFetchUrl = (commitId) => {
62
- const { addCorsPrefix, customCorsPrefix, gistOwner, gistId, } = this;
63
+ const { addCorsPrefix, customCorsPrefix, gistOwner, gistId } = this;
63
64
  const url = `https://gist.githubusercontent.com/${gistOwner}` +
64
65
  `/${gistId}/raw/${commitId}/${this.fileName}`;
65
- if (addCorsPrefix === false)
66
+ if (!addCorsPrefix)
66
67
  return url;
67
- if (customCorsPrefix)
68
+ if (customCorsPrefix != null)
68
69
  return customCorsPrefix(url);
69
70
  return constants_1.default.corsAnywhere + url;
70
71
  };
@@ -95,11 +96,18 @@ class GistFile {
95
96
  this.customCorsPrefix = (_b = options.cors) === null || _b === void 0 ? void 0 : _b.customPrefix;
96
97
  }
97
98
  // Getters
98
- get hasUpdates() { return this.fileHasUpdates; }
99
- get name() { return this.fileName; }
100
- get content() { return this.fileContent; }
99
+ get hasUpdates() {
100
+ return this.fileHasUpdates;
101
+ }
102
+ get name() {
103
+ return this.fileName;
104
+ }
105
+ get content() {
106
+ return this.fileContent;
107
+ }
101
108
  // Setters
102
- set hasUpdates(value) { this.fileHasUpdates = value; }
103
- ;
109
+ set hasUpdates(value) {
110
+ this.fileHasUpdates = value;
111
+ }
104
112
  }
105
113
  exports.default = GistFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-github-gist-api",
3
- "version": "2.0.49",
3
+ "version": "2.0.52",
4
4
  "description": "A way to store data on Github Gist.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -43,14 +43,18 @@
43
43
  "@commitlint/cli": "^16.0.0",
44
44
  "@commitlint/config-conventional": "^16.0.0",
45
45
  "@types/jest": "^27.0.2",
46
- "eslint": "^8.4.1",
46
+ "@typescript-eslint/eslint-plugin": "^4.0.1",
47
+ "@typescript-eslint/parser": "^4.0.0",
48
+ "eslint": "^7.32.0",
47
49
  "eslint-config-airbnb": "^19.0.2",
48
50
  "eslint-config-node": "^4.1.0",
49
51
  "eslint-config-prettier": "^8.3.0",
52
+ "eslint-config-standard-with-typescript": "^21.0.1",
50
53
  "eslint-plugin-import": "^2.25.3",
51
54
  "eslint-plugin-jsx-a11y": "^6.5.1",
52
55
  "eslint-plugin-node": "^11.1.0",
53
56
  "eslint-plugin-prettier": "^4.0.0",
57
+ "eslint-plugin-promise": "^4.2.1",
54
58
  "eslint-plugin-react": "^7.27.1",
55
59
  "eslint-plugin-react-hooks": "^4.3.0",
56
60
  "husky": "^7.0.4",