mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-05 21:53:56 +00:00
34 lines
659 B
JavaScript
34 lines
659 B
JavaScript
'use strict'
|
|
|
|
exports.encodeHtml = (str) => str.replace(/</g, '<').replace(/>/g, '>')
|
|
|
|
exports.getContext = function (req, res) {
|
|
return {
|
|
req: req,
|
|
res: res
|
|
}
|
|
}
|
|
|
|
exports.setAnsiColors = function (ansiHTML) {
|
|
ansiHTML.setColors({
|
|
reset: ['efefef', 'a6004c'],
|
|
darkgrey: '5a012b',
|
|
yellow: 'ffab07',
|
|
green: 'aeefba',
|
|
magenta: 'ff84bf',
|
|
blue: '3505a0',
|
|
cyan: '56eaec',
|
|
red: '4e053a'
|
|
})
|
|
}
|
|
|
|
exports.waitFor = function * (ms) {
|
|
return new Promise(function (resolve) {
|
|
setTimeout(resolve, (ms || 0))
|
|
})
|
|
}
|
|
|
|
exports.urlJoin = function () {
|
|
return [].slice.call(arguments).join('/').replace(/\/+/g, '/')
|
|
}
|