fix: occured → occurred

This commit is contained in:
Julien Fontanet 2018-12-06 17:18:08 +01:00
parent 2353552e11
commit 11f742b020
4 changed files with 28 additions and 28 deletions

View File

@ -14,7 +14,7 @@ if (!(symbol in global)) {
// -------------------------------------------------------------------
function Log (data, level, namespace, message, time) {
function Log(data, level, namespace, message, time) {
this.data = data
this.level = level
this.namespace = namespace
@ -22,7 +22,7 @@ function Log (data, level, namespace, message, time) {
this.time = time
}
function Logger (namespace) {
function Logger(namespace) {
this._namespace = namespace
// bind all logging methods
@ -37,11 +37,11 @@ const { prototype } = Logger
for (const name in LEVELS) {
const level = LEVELS[name]
prototype[name.toLowerCase()] = function (message, data) {
prototype[name.toLowerCase()] = function(message, data) {
if (typeof message !== 'string') {
if (message instanceof Error) {
data = { error: message }
;({ message = 'an error has occured' } = message)
;({ message = 'an error has occurred' } = message)
} else {
return this.warn('incorrect value passed to logger', {
level,
@ -53,13 +53,13 @@ for (const name in LEVELS) {
}
}
prototype.wrap = function (message, fn) {
prototype.wrap = function(message, fn) {
const logger = this
const warnAndRethrow = error => {
logger.warn(message, { error })
throw error
}
return function () {
return function() {
try {
const result = fn.apply(this, arguments)
const then = result != null && result.then

View File

@ -17,7 +17,7 @@ import { fromCallback, pAll, pReflect, promisify } from 'promise-toolbox'
// ===================================================================
export function camelToSnakeCase (string) {
export function camelToSnakeCase(string) {
return string.replace(
/([a-z0-9])([A-Z])/g,
(_, prevChar, currChar) => `${prevChar}_${currChar.toLowerCase()}`
@ -48,7 +48,7 @@ export const diffItems = (coll1, coll2) => {
// -------------------------------------------------------------------
// Ensure the value is an array, wrap it if necessary.
export function ensureArray (value) {
export function ensureArray(value) {
if (value === undefined) {
return []
}
@ -59,7 +59,7 @@ export function ensureArray (value) {
// -------------------------------------------------------------------
// Returns the value of a property and removes it from the object.
export function extractProperty (obj, prop) {
export function extractProperty(obj, prop) {
const value = obj[prop]
delete obj[prop]
return value
@ -68,7 +68,7 @@ export function extractProperty (obj, prop) {
// -------------------------------------------------------------------
// Returns the first defined (non-undefined) value.
export const firstDefined = function () {
export const firstDefined = function() {
const n = arguments.length
for (let i = 0; i < n; ++i) {
const arg = arguments[i]
@ -118,7 +118,7 @@ export const generateToken = (randomBytes => {
// -------------------------------------------------------------------
export const formatXml = (function () {
export const formatXml = (function() {
const builder = new xml2js.Builder({
headless: true,
})
@ -126,7 +126,7 @@ export const formatXml = (function () {
return (...args) => builder.buildObject(...args)
})()
export const parseXml = (function () {
export const parseXml = (function() {
const opts = {
mergeAttrs: true,
explicitArray: false,
@ -199,7 +199,7 @@ export const noop = () => {}
// array or object) containing promise inspections.
//
// Usage: pSettle(promises) or promises::pSettle()
export function pSettle (promises) {
export function pSettle(promises) {
return (this || promises)::pAll(p => Promise.resolve(p)::pReflect())
}
@ -217,7 +217,7 @@ export {
// -------------------------------------------------------------------
export function parseSize (size) {
export function parseSize(size) {
if (!isString(size)) {
return size
}
@ -294,7 +294,7 @@ export const DONE = {}
// `DONE` provided as the fourth argument.
//
// Usage: map(collection, item => item + 1)
export function map (
export function map(
collection,
iteratee,
target = has(collection, 'length') ? [] : {}
@ -367,7 +367,7 @@ export const thunkToArray = thunk => {
// Creates a new function which throws an error.
//
// ```js
// promise.catch(throwFn('an error has occured'))
// promise.catch(throwFn('an error has occurred'))
//
// function foo (param = throwFn('param is required')()) {}
// ```

View File

@ -135,10 +135,10 @@ export const connectStore = (mapStateToProps, opts = {}) => {
if (opts.withRef && 'value' in Component.prototype) {
Object.defineProperty(ConnectedComponent.prototype, 'value', {
configurable: true,
get () {
get() {
return this.getWrappedInstance().value
},
set (value) {
set(value) {
this.getWrappedInstance().value = value
},
})
@ -307,7 +307,7 @@ export const routes = (indexRoute, childRoutes) => target => {
// Creates a new function which throws an error.
//
// ```js
// promise.catch(throwFn('an error has occured'))
// promise.catch(throwFn('an error has occurred'))
//
// function foo (param = throwFn('param is required')) {}
// ```
@ -374,7 +374,7 @@ export const resolveResourceSets = resourceSets =>
//
// newString === 'foo_COPY_foo_42_32'
// ```
export function buildTemplate (pattern, rules) {
export function buildTemplate(pattern, rules) {
const regExp = new RegExp(join(map(keys(rules), escapeRegExp), '|'), 'g')
return (...params) =>
replace(pattern, regExp, match => {
@ -404,7 +404,7 @@ export const htmlFileToStream = file => {
stream.emit('error', error)
}
stream._read = function (size) {
stream._read = function(size) {
if (offset >= file.size) {
stream.push(null)
} else {
@ -442,7 +442,7 @@ const OPs = {
}
const makeNiceCompare = compare =>
function () {
function() {
const { length } = arguments
if (length === 2) {
return compare(arguments[0], arguments[1])

View File

@ -43,7 +43,7 @@ if (+process.env.XOA_PLAN < 5) {
// FIXME: can't translate
const LABELS_BY_STATE = {
disconnected: 'Disconnected',
error: 'An error occured',
error: 'An error occurred',
registerNeeded: 'Registration required',
updating: 'Updating',
upgradeNeeded: 'Upgrade required',
@ -87,7 +87,7 @@ const Updates = decorate([
showPackagesList: false,
}),
effects: {
async configure () {
async configure() {
await xoaUpdater.configure(
pick(this.state, [
'proxyHost',
@ -98,11 +98,11 @@ const Updates = decorate([
)
return this.effects.resetProxyConfig()
},
initialize () {
initialize() {
return this.effects.update()
},
linkState,
async register () {
async register() {
const { state } = this
const { isRegistered } = state
@ -133,7 +133,7 @@ const Updates = decorate([
return initialRegistrationState()
},
resetProxyConfig: initialProxyState,
async startTrial () {
async startTrial() {
try {
await confirm({
title: _('trialReadyModal'),
@ -158,7 +158,7 @@ const Updates = decorate([
jobs !== undefined &&
backupNgJobs !== undefined &&
some(jobs.concat(backupNgJobs), job => job.runId !== undefined),
async installedPackages () {
async installedPackages() {
const { installer, updater, npm } = await xoaUpdater.getLocalManifest()
return { ...installer, ...updater, ...npm }
},