Sha256: 82e2ef9a712593a09bce7fd196a68fa6e6a898e22bc226b2e5baddac50aa9f30

Contents?: true

Size: 876 Bytes

Versions: 26

Compression:

Stored size: 876 Bytes

Contents

import hasOwnProp from '../utils/has-own-prop';
import toInt from '../utils/to-int';

var tokens = {};

export function addParseToken (token, callback) {
    var i, func = callback;
    if (typeof token === 'string') {
        token = [token];
    }
    if (typeof callback === 'number') {
        func = function (input, array) {
            array[callback] = toInt(input);
        };
    }
    for (i = 0; i < token.length; i++) {
        tokens[token[i]] = func;
    }
}

export function addWeekParseToken (token, callback) {
    addParseToken(token, function (input, array, config, token) {
        config._w = config._w || {};
        callback(input, config._w, config, token);
    });
}

export function addTimeToArrayFromToken(token, input, config) {
    if (input != null && hasOwnProp(tokens, token)) {
        tokens[token](input, config._a, config, token);
    }
}

Version data entries

26 entries across 26 versions & 5 rubygems

Version Path
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/moment/src/lib/parse/token.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/moment/src/lib/parse/token.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/moment/src/lib/parse/token.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/moment/src/lib/parse/token.js
date_picker-0.0.9 test/dummy/vendor/assets/components/moment/src/lib/parse/token.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/moment/src/lib/parse/token.js
locomotivecms-3.2.0.rc1 vendor/assets/components/locomotive_sources/moment/src/lib/parse/token.js
locomotivecms-3.1.1 vendor/assets/components/locomotive_sources/moment/src/lib/parse/token.js
locomotivecms-3.1.0 vendor/assets/components/locomotive_sources/moment/src/lib/parse/token.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/moment/src/lib/parse/token.js
locomotivecms-3.1.0.rc3 vendor/assets/components/locomotive_sources/moment/src/lib/parse/token.js
locomotivecms-3.1.0.rc2 vendor/assets/components/locomotive_sources/moment/src/lib/parse/token.js
locomotivecms-3.1.0.rc1 vendor/assets/components/locomotive_sources/moment/src/lib/parse/token.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/moment/src/lib/parse/token.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/moment/src/lib/parse/token.js
date_picker-0.0.8 test/dummy/vendor/assets/components/moment/src/lib/parse/token.js
date_picker-0.0.7 test/dummy/vendor/assets/components/moment/src/lib/parse/token.js
sedge_cms-0.0.1 vendor/assets/components/moment/src/lib/parse/token.js
date_picker-0.0.6 test/dummy/vendor/assets/components/moment/src/lib/parse/token.js
date_picker-0.0.5 test/dummy/vendor/assets/components/moment/src/lib/parse/token.js