 |
|
negativeInfinity
V2EX member #276161, joined on 2017-12-22 03:46:15 +08:00
|
negativeInfinity's recent replies
可以用用 jshint, 它会告诉你具体那个文件哪一行出现了什么样的编译错误。
不支持缩进?哪里能看到输入框支持什么样的格式呢?
```
let test = 'test';
```
```javascript
let testAgain = 'test';
```
const rp = require('request-promise');
const getToken = () => {
return getMySavedToken().then((token) => { // Assume your getMySavedToken API returns a Promise.
if (token && hasExpired(token)) { // If token hasn't expired.
return token;
}
return rp.get('Get a new token here').then((body) => {
return JSON.parse(body).access_token;
});
});
};
getToken().then((token) => {
// use my token
}).catch((err) => {
// Oops, something's wrong!
});