corrade-nucleus-nucleons – Blame information for rev 38
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
38 | office | 1 | import hasOwnProp from '../utils/has-own-prop'; |
2 | import isNumber from '../utils/is-number'; |
||
3 | import toInt from '../utils/to-int'; |
||
4 | |||
5 | var tokens = {}; |
||
6 | |||
7 | export function addParseToken (token, callback) { |
||
8 | var i, func = callback; |
||
9 | if (typeof token === 'string') { |
||
10 | token = [token]; |
||
11 | } |
||
12 | if (isNumber(callback)) { |
||
13 | func = function (input, array) { |
||
14 | array[callback] = toInt(input); |
||
15 | }; |
||
16 | } |
||
17 | for (i = 0; i < token.length; i++) { |
||
18 | tokens[token[i]] = func; |
||
19 | } |
||
20 | } |
||
21 | |||
22 | export function addWeekParseToken (token, callback) { |
||
23 | addParseToken(token, function (input, array, config, token) { |
||
24 | config._w = config._w || {}; |
||
25 | callback(input, config._w, config, token); |
||
26 | }); |
||
27 | } |
||
28 | |||
29 | export function addTimeToArrayFromToken(token, input, config) { |
||
30 | if (input != null && hasOwnProp(tokens, token)) { |
||
31 | tokens[token](input, config._a, config, token); |
||
32 | } |
||
33 | } |