Skip to content

Commit

Permalink
Merge pull request #1 from ruanyl/wdev
Browse files Browse the repository at this point in the history
精简代码,增加可读性
  • Loading branch information
jeppeter authored May 25, 2017
2 parents 79056f3 + 9e6d850 commit 8f64141
Show file tree
Hide file tree
Showing 7 changed files with 121 additions and 261 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"rules": {
"arrow-parens": ["error", "as-needed"],
"comma-dangle": ["error", "always-multiline"],
"dot-notation": 0,
"guard-for-in": 0,
"no-underscore-dangle": 0,
Expand Down
6 changes: 3 additions & 3 deletions example/getkdata/getk.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ args.args.forEach(function(code) {
options.end = args.end;
options.ktype = args.ktype;
options.autype = args.autype;
options.index = args.index;
options.isIndex = args.index;
stock.getKData(options).then(data => {
console.log('code %s',code);
data.forEach(function(d) {
console.log('%s',d);
});
});
})
.catch(err => {
console.error('get %s error %s', code, err);
});
});
});
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "node ./node_modules/babel-cli/bin/babel.js src --out-dir lib",
"build:watch": "node ./node_modules/babel-cli/bin/babel.js src --out-dir lib --watch",
"prepublish": "npm run build",
"buildexample" : "node ./node_modules/babel-cli/bin/babel.js example --out-dir libexample",
"buildexample": "node ./node_modules/babel-cli/bin/babel.js example --out-dir libexample",
"lint": "node ./node_modules/eslint/bin/eslint.js src/"
},
"repository": {
Expand All @@ -26,12 +26,13 @@
},
"homepage": "https://github.com/ruanyl/tushare.js#readme",
"dependencies": {
"async": "^2.4.1",
"iconv-lite": "^0.4.15",
"js-base64": "^2.1.9",
"moment": "^2.17.1",
"no-fetch": "^1.6.2",
"whatwg-fetch": "^2.0.2",
"strftime" : "^0.10.0"
"ramda": "^0.23.0",
"strftime": "^0.10.0",
"whatwg-fetch": "^2.0.2"
},
"devDependencies": {
"ava": "^0.18.1",
Expand All @@ -48,7 +49,7 @@
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.9.0",
"extargsparse" : "^0.2.2"
"extargsparse": "^0.2.2"
},
"ava": {
"require": [
Expand Down
12 changes: 6 additions & 6 deletions src/stock/cons.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import moment from 'moment';
import strftime from 'strftime';

export const K_TYPE = {
day: 'akdaily',
Expand All @@ -12,17 +12,17 @@ export const K_LABELS = ['day', 'month', 'week'];
export const K_MIN_LABELS = ['1', '5', '15', '30', '30'];

export const INDEX_LIST = {
'sh': 'sh000001',
'sz': 'sz399001',
sh: 'sh000001',
sz: 'sz399001',
hs300: 'sz399300',
sz50: 'sh000016',
zxb: 'sz399005',
cyb: 'sz399006',
zx300: 'sz399008',
zh500: 'sh000905',
'399990': 'sz399990',
399990: 'sz399990',
'000006': 'sh000006',
'399998': 'sz399998',
399998: 'sz399998',
399436: 'sz399436',
399678: 'sz399678',
399804: 'sz399804',
Expand Down Expand Up @@ -589,6 +589,6 @@ export const INDEX_LIST = {
hkHSI: 'hkHSI',
};

export const DATE_NOW = moment().format('YYYY-MM-DD');
export const DATE_NOW = strftime('%Y-%m-%d', new Date());
export const CUR_YEAR = DATE_NOW.split('-')[0];
export const CUR_MONTH = DATE_NOW.split('-')[1];
Loading

0 comments on commit 8f64141

Please sign in to comment.