@ridi/parser-core
Advanced tools
Comparing version 0.3.0-alpha-6 to 0.3.0-alpha-7
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.openZip = exports.validateOptions = exports.isUrl = exports.isString = exports.isObject = exports.isFunc = exports.isExists = exports.isBool = exports.isArray = exports.getType = exports.stringContains = exports.readEntries = exports.getPathes = exports.safePathJoin = exports.safePath = exports.safeDirname = exports.parseBool = exports.mergeObjects = exports.LogLevel = exports.Logger = exports.mustOverride = exports.createError = exports.Errors = exports.CryptoProvider = exports.Cryptor = undefined; | ||
exports.openZip = exports.validateOptions = exports.isUrl = exports.isString = exports.isObject = exports.isFunc = exports.isExists = exports.isBool = exports.isArray = exports.getType = exports.stringContains = exports.readEntries = exports.getPathes = exports.safePathJoin = exports.safePath = exports.safeDirname = exports.Parser = exports.parseBool = exports.mergeObjects = exports.LogLevel = exports.Logger = exports.mustOverride = exports.createError = exports.Errors = exports.CryptoProvider = exports.Cryptor = undefined; | ||
@@ -33,2 +33,6 @@ var _Cryptor = require('./Cryptor'); | ||
var _Parser = require('./Parser'); | ||
var _Parser2 = _interopRequireDefault(_Parser); | ||
var _pathUtil = require('./pathUtil'); | ||
@@ -65,2 +69,3 @@ | ||
exports.parseBool = _parseBool2.default; | ||
exports.Parser = _Parser2.default; | ||
exports.safeDirname = _pathUtil.safeDirname; | ||
@@ -67,0 +72,0 @@ exports.safePath = _pathUtil.safePath; |
@@ -36,2 +36,4 @@ 'use strict'; | ||
var _typecheck = require('./typecheck'); | ||
var _stringContains = require('./stringContains'); | ||
@@ -43,2 +45,3 @@ | ||
/* eslint-disable no-console */ | ||
var LogLevel = (0, _freeze2.default)({ | ||
@@ -50,3 +53,3 @@ SILENT: 'silent', | ||
VERBOSE: 'verbose' | ||
}); /* eslint-disable no-console */ | ||
}); | ||
@@ -70,2 +73,3 @@ var Logger = function () { | ||
this._logLevel = (0, _stringContains2.default)((0, _values2.default)(LogLevel), logLevel) ? logLevel : LogLevel.ERROR; | ||
this._firstTime = null; | ||
} | ||
@@ -101,3 +105,3 @@ | ||
if (!(0, _stringContains2.default)([LogLevel.INFO, LogLevel.VERBOSE], this.logLevel)) { | ||
_context.next = 8; | ||
_context.next = 9; | ||
break; | ||
@@ -107,6 +111,10 @@ } | ||
startTime = new Date().getTime(); | ||
_context.next = 4; | ||
if (!(0, _typecheck.isExists)(this._firstTime)) { | ||
this._firstTime = startTime; | ||
} | ||
_context.next = 5; | ||
return func.apply(thisArg, argsArray); | ||
case 4: | ||
case 5: | ||
_result = _context.sent; | ||
@@ -121,11 +129,11 @@ | ||
case 8: | ||
_context.next = 10; | ||
case 9: | ||
_context.next = 11; | ||
return func.apply(thisArg, argsArray); | ||
case 10: | ||
case 11: | ||
result = _context.sent; | ||
return _context.abrupt('return', result); | ||
case 12: | ||
case 13: | ||
case 'end': | ||
@@ -150,2 +158,5 @@ return _context.stop(); | ||
var startTime = new Date().getTime(); | ||
if (!(0, _typecheck.isExists)(this._firstTime)) { | ||
this._firstTime = startTime; | ||
} | ||
var result = func.apply(thisArg, argsArray); | ||
@@ -163,4 +174,5 @@ | ||
Logger.prototype.warn = function warn(message) { | ||
if ((0, _stringContains2.default)([LogLevel.WARNING, LogLevel.VERBOSE], this.logLevel)) { | ||
Logger.prototype.result = function result(message) { | ||
var time = this._firstTime || new Date().getTime(); | ||
if ((0, _stringContains2.default)([LogLevel.INFO, LogLevel.VERBOSE], this.logLevel)) { | ||
var _console4; | ||
@@ -172,8 +184,9 @@ | ||
(_console4 = console).warn.apply(_console4, ['[' + this.namespace + '] ' + message].concat(optionalParams)); | ||
(_console4 = console).log.apply(_console4, ['[' + this.namespace + '] ' + message + ' (' + (new Date().getTime() - time) + 'ms)'].concat(optionalParams)); | ||
} | ||
this._firstTime = null; | ||
}; | ||
Logger.prototype.error = function error(message) { | ||
if ((0, _stringContains2.default)([LogLevel.ERROR, LogLevel.VERBOSE], this.logLevel)) { | ||
Logger.prototype.warn = function warn(message) { | ||
if ((0, _stringContains2.default)([LogLevel.WARNING, LogLevel.VERBOSE], this.logLevel)) { | ||
var _console5; | ||
@@ -185,6 +198,18 @@ | ||
(_console5 = console).error.apply(_console5, ['[' + this.namespace + '] ' + message].concat(optionalParams)); | ||
(_console5 = console).warn.apply(_console5, ['[' + this.namespace + '] ' + message].concat(optionalParams)); | ||
} | ||
}; | ||
Logger.prototype.error = function error(message) { | ||
if ((0, _stringContains2.default)([LogLevel.ERROR, LogLevel.VERBOSE], this.logLevel)) { | ||
var _console6; | ||
for (var _len6 = arguments.length, optionalParams = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { | ||
optionalParams[_key6 - 1] = arguments[_key6]; | ||
} | ||
(_console6 = console).error.apply(_console6, ['[' + this.namespace + '] ' + message].concat(optionalParams)); | ||
} | ||
}; | ||
return Logger; | ||
@@ -191,0 +216,0 @@ }(); |
@@ -127,6 +127,12 @@ 'use strict'; | ||
} | ||
_context2.next = 4; | ||
if (entry.path.endsWith('/')) { | ||
_context2.next = 7; | ||
break; | ||
} | ||
_context2.next = 5; | ||
return writeFile(entry, output); | ||
case 4: | ||
case 5: | ||
error = _context2.sent; | ||
@@ -138,3 +144,3 @@ | ||
case 6: | ||
case 7: | ||
case 'end': | ||
@@ -141,0 +147,0 @@ return _context2.stop(); |
{ | ||
"name": "@ridi/parser-core", | ||
"version": "0.3.0-alpha-6", | ||
"version": "0.3.0-alpha-7", | ||
"description": "Utilities for parsers", | ||
@@ -5,0 +5,0 @@ "author": { |
61633
17
1543
4