chrono-node
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -7,3 +7,18 @@ // chrono.js | ||
var chrono = {} | ||
var chrono = function(){ | ||
for(var attr in chrono){ | ||
this[attr] = chrono[attr] | ||
} | ||
this.parsers = {} | ||
for(var p in chrono.parsers) this.parsers[p] = chrono.parsers[p]; | ||
this.refiners = {} | ||
for(var r in chrono.refiners) this.refiners[r] = chrono.refiners[r]; | ||
this.timezoneMap = {} | ||
for(var r in chrono.timezoneMap) this.timezoneMap[r] = chrono.timezoneMap[r]; | ||
} | ||
chrono.timezoneMap = {}; | ||
chrono.parsers = {}; | ||
@@ -10,0 +25,0 @@ chrono.refiners = {}; |
// Karma configuration | ||
// Generated on Sat Jun 22 2013 14:46:29 GMT+0900 (JST) | ||
// Generated on Mon Oct 28 2013 19:53:46 GMT+0900 (JST) | ||
module.exports = function(config) { | ||
config.set({ | ||
// base path, that will be used to resolve files and exclude | ||
basePath = ''; | ||
// base path, that will be used to resolve files and exclude | ||
basePath: '', | ||
// list of files / patterns to load in the browser | ||
files = [ | ||
QUNIT, | ||
QUNIT_ADAPTER, | ||
'moment.js', | ||
'chrono.min.js', | ||
'chrono.js', | ||
'timezone.js', | ||
'parsers/*.js', | ||
'parsers/*/*.js', | ||
'refiners/*.js', | ||
'refiners/*/*.js', | ||
'test-qunit/Test*.js', | ||
]; | ||
// frameworks to use | ||
frameworks: ['qunit'], | ||
// list of files / patterns to load in the browser | ||
files: [ | ||
'moment.js', | ||
'chrono.min.js', | ||
'chrono.js', | ||
'timezone.js', | ||
'parsers/*.js', | ||
'parsers/*/*.js', | ||
'refiners/*.js', | ||
'refiners/*/*.js', | ||
'test-qunit/Test*.js', | ||
], | ||
// list of files to exclude | ||
exclude = [ | ||
]; | ||
// list of files to exclude | ||
exclude: [ | ||
], | ||
// test results reporter to use | ||
// possible values: 'dots', 'progress', 'junit' | ||
reporters = ['progress']; | ||
// test results reporter to use | ||
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' | ||
reporters: ['progress'], | ||
// web server port | ||
port = 9876; | ||
// web server port | ||
port: 9876, | ||
// cli runner port | ||
runnerPort = 9100; | ||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
// enable / disable colors in the output (reporters and logs) | ||
colors = true; | ||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
// level of logging | ||
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG | ||
logLevel = LOG_INFO; | ||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch = true; | ||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera (has to be installed with `npm install karma-opera-launcher`) | ||
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) | ||
// - PhantomJS | ||
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) | ||
browsers: ['Chrome'], | ||
// Start these browsers, currently available: | ||
// - Chrome | ||
// - ChromeCanary | ||
// - Firefox | ||
// - Opera | ||
// - Safari (only Mac) | ||
// - PhantomJS | ||
// - IE (only Windows) | ||
browsers = ['Chrome']; | ||
// If browser does not capture in given timeout [ms], kill it | ||
captureTimeout: 60000, | ||
// If browser does not capture in given timeout [ms], kill it | ||
captureTimeout = 60000; | ||
// Continuous Integration mode | ||
// if true, it capture browsers, run tests and exit | ||
singleRun = false; | ||
// Continuous Integration mode | ||
// if true, it capture browsers, run tests and exit | ||
singleRun: false | ||
}); | ||
}; |
@@ -5,14 +5,28 @@ { | ||
"homepage": "http://github.com/berryboy/chrono", | ||
"repository": { | ||
"type" : "git", | ||
"url" : "https://github.com/berryboy/chrono.git" | ||
}, | ||
"version": "0.1.6", | ||
"directories" : { | ||
"improvers" : "./improvers", | ||
"parsers" : "./parsers", | ||
"test-nodeunit" : "./test-nodeunit", | ||
"test-qunit" : "./test-qunit" | ||
}, | ||
"main": "./chrono" | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/berryboy/chrono.git" | ||
}, | ||
"version": "0.1.7", | ||
"directories": { | ||
"improvers": "./improvers", | ||
"parsers": "./parsers", | ||
"test-nodeunit": "./test-nodeunit", | ||
"test-qunit": "./test-qunit" | ||
}, | ||
"main": "./chrono", | ||
"devDependencies": { | ||
"qunitjs": "~1.12.0", | ||
"karma-script-launcher": "~0.1.0", | ||
"karma-chrome-launcher": "~0.1.0", | ||
"karma-firefox-launcher": "~0.1.0", | ||
"karma-html2js-preprocessor": "~0.1.0", | ||
"karma-jasmine": "~0.1.3", | ||
"karma-requirejs": "~0.1.0", | ||
"karma-coffee-preprocessor": "~0.1.0", | ||
"karma-phantomjs-launcher": "~0.1.0", | ||
"karma": "~0.10.4", | ||
"karma-qunit": "~0.1.1", | ||
"uglify-js": "~2.4.1" | ||
} | ||
} |
@@ -14,3 +14,3 @@ /* | ||
ref = ref || new Date(); | ||
parserTypes = parserTypes || Object.keys(chrono.parsers); | ||
parserTypes = parserTypes || Object.keys(this.parsers); | ||
@@ -23,4 +23,4 @@ var currentParserIndex = 0; | ||
for(var i=0; i<parserTypes.length;i++){ | ||
if(chrono.parsers[parserTypes[i]]) | ||
parsers.push(new chrono.parsers[parserTypes[i]] (text, ref, opt) ); | ||
if(this.parsers[parserTypes[i]]) | ||
parsers.push(new this.parsers[parserTypes[i]] (text, ref, opt) ); | ||
} | ||
@@ -27,0 +27,0 @@ |
@@ -20,3 +20,3 @@ Chrono | ||
<script src="https://rawgithub.com/berryboy/chrono/master/chrono.min.js"></script> | ||
<script src="https://rawgithub.com/wanasit/chrono/master/chrono.min.js"></script> | ||
@@ -23,0 +23,0 @@ ## USAGE |
@@ -14,4 +14,4 @@ /* | ||
var orderedRefiners = {}; | ||
for(var name in chrono.refiners){ | ||
var refiner = chrono.refiners[name]; | ||
for(var name in this.refiners){ | ||
var refiner = this.refiners[name]; | ||
var order = refiner.order || 0; | ||
@@ -18,0 +18,0 @@ orderedRefiners[order] = orderedRefiners[order] || []; |
@@ -341,1 +341,35 @@ test("Test - Module Status", function() { | ||
}); | ||
test("Test - Obj Instanciate", function() { | ||
var _chrono = new chrono(); | ||
ok(_chrono, 'Init: chrono'); | ||
ok(_chrono.parse, 'Init: chrono.parse'); | ||
ok(typeof(_chrono.parse) === 'function', 'Init: chrono.parse'); | ||
var results = _chrono.parse('2012-8-7') | ||
ok(results, JSON.stringify(results)); | ||
ok(results.length > 0, JSON.stringify(results)); | ||
// Try delete a parser | ||
delete _chrono.parsers.InternationalStandardParser | ||
results = _chrono.parse('2012-8-7') | ||
ok(results, JSON.stringify(results)); | ||
ok(results.length === 0, JSON.stringify(results)); | ||
// Delete a parser doesn't effect the global parsing | ||
results = chrono.parse('2012-8-7') | ||
ok(results, JSON.stringify(results)); | ||
ok(results.length > 0, JSON.stringify(results)); | ||
// Try update the timezone | ||
_chrono.timezoneMap['CST'] = 1000 | ||
ok(_chrono.timezoneMap['CST'] != chrono.timezoneMap['CST'], chrono.timezoneMap['CST']); | ||
}); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
489213
0
7757
12