Skip to content

Commit

Permalink
refactor: ♻️ lint
Browse files Browse the repository at this point in the history
  • Loading branch information
harshzalavadiya authored Nov 16, 2021
1 parent 9883258 commit 9354a09
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"singleQuote": true
}
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ cordova plugin add cordova-plugin-simple-file-chooser

```js
/**
* Displays native prompt for user to select one or more files.
*
* @param accept Optional MIME type filter (e.g. 'image/gif,video/*').
*
* @returns Promise containing selected files' information,
* MIME type, display name, and original URI.
*
* If user cancels, promise will be resolved as undefined.
* If error occurs, promise will be rejected.
*/
* Displays native prompt for user to select one or more files.
*
* @param accept Optional MIME type filter (e.g. 'image/gif,video/*').
*
* @returns Promise containing selected files' information,
* MIME type, display name, and original URI.
*
* If user cancels, promise will be resolved as undefined.
* If error occurs, promise will be rejected.
*/
chooser.getFiles(accept?: string) : Promise<undefined|{
mediaType: string;
name: string;
Expand All @@ -47,4 +47,4 @@ chooser.getFiles(accept?: string) : Promise<undefined|{

### Note

If calling in typescript don't use types instead use direct javascript by `declare var chooser` on your ts file.
If calling in typescript don't use types instead use direct javascript by `declare var chooser` on your ts file.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/harshzalavadiya/cordova-plugin-simple-file-chooser.git"
"url": "git+https://github.com/hc-oss/cordova-plugin-simple-file-chooser.git"
},
"keywords": [
"file",
Expand All @@ -18,7 +18,7 @@
"author": "Cyph, Inc. <[email protected]> (https://github.com/cyph)",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/harshzalavadiya/cordova-plugin-simple-file-chooser/issues"
"url": "https://github.com/hc-oss/cordova-plugin-simple-file-chooser/issues"
},
"cordova": {
"id": "cordova-plugin-simple-file-chooser",
Expand All @@ -30,4 +30,4 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}
}
13 changes: 8 additions & 5 deletions www/chooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ module.exports = {
function (json) {
try {
resolve(JSON.parse(json));
}
catch (err) {
} catch (err) {
reject(err);
}
},
reject,
'Chooser',
'getFiles',
[(typeof accept === 'string' ? accept.replace(/\s/g, '') : undefined) || '*/*']
[
(typeof accept === 'string'
? accept.replace(/\s/g, '')
: undefined) || '*/*',
]
);
});

Expand All @@ -25,5 +28,5 @@ module.exports = {
}

return result;
}
};
},
};

0 comments on commit 9354a09

Please sign in to comment.