Rewrite map to forEach when it is unnecessary
This commit is contained in:
parent
e221706123
commit
c4c63ec9fe
|
@ -6,7 +6,7 @@ const locales = ['de', 'fr', 'it', 'ja', 'ko', 'pl', 'zh_cn']
|
||||||
|
|
||||||
describe('i18n', () => {
|
describe('i18n', () => {
|
||||||
describe('should not define duplicate keys', () => {
|
describe('should not define duplicate keys', () => {
|
||||||
locales.map(locale => {
|
locales.forEach(locale => {
|
||||||
it(`${locale} translation`, () => {
|
it(`${locale} translation`, () => {
|
||||||
const targetJson = JSON.parse(
|
const targetJson = JSON.parse(
|
||||||
fs.readFileSync(path.resolve(__dirname, `../../src/config/locales/${locale}/translation.json`), 'utf8')
|
fs.readFileSync(path.resolve(__dirname, `../../src/config/locales/${locale}/translation.json`), 'utf8')
|
||||||
|
|
|
@ -663,7 +663,7 @@ ipcMain.on('start-all-user-streamings', (event: IpcMainEvent, accounts: Array<Lo
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('stop-all-user-streamings', () => {
|
ipcMain.on('stop-all-user-streamings', () => {
|
||||||
Object.keys(userStreamings).map((key: string) => {
|
Object.keys(userStreamings).forEach((key: string) => {
|
||||||
if (userStreamings[key]) {
|
if (userStreamings[key]) {
|
||||||
userStreamings[key]!.stop()
|
userStreamings[key]!.stop()
|
||||||
userStreamings[key] = null
|
userStreamings[key] = null
|
||||||
|
@ -676,7 +676,7 @@ ipcMain.on('stop-all-user-streamings', () => {
|
||||||
* @param id specified user id in nedb.
|
* @param id specified user id in nedb.
|
||||||
*/
|
*/
|
||||||
const stopUserStreaming = (id: string) => {
|
const stopUserStreaming = (id: string) => {
|
||||||
Object.keys(userStreamings).map((key: string) => {
|
Object.keys(userStreamings).forEach((key: string) => {
|
||||||
if (key === id && userStreamings[id]) {
|
if (key === id && userStreamings[id]) {
|
||||||
userStreamings[id]!.stop()
|
userStreamings[id]!.stop()
|
||||||
userStreamings[id] = null
|
userStreamings[id] = null
|
||||||
|
|
|
@ -234,7 +234,7 @@ const actions: ActionTree<NewTootState, RootState> = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.polls.length > 1) {
|
if (params.polls.length > 1) {
|
||||||
params.polls.map(poll => {
|
params.polls.forEach(poll => {
|
||||||
if (poll.length < 1) {
|
if (poll.length < 1) {
|
||||||
throw new NewTootPollInvalid()
|
throw new NewTootPollInvalid()
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ const actions: ActionTree<NewTootState, RootState> = {
|
||||||
commit(MUTATION_TYPES.UPDATE_INITIAL_SPOILER, message.spoiler_text)
|
commit(MUTATION_TYPES.UPDATE_INITIAL_SPOILER, message.spoiler_text)
|
||||||
commit(MUTATION_TYPES.CHANGE_MODAL, true)
|
commit(MUTATION_TYPES.CHANGE_MODAL, true)
|
||||||
let value: number = Visibility.Public.value
|
let value: number = Visibility.Public.value
|
||||||
Object.keys(Visibility).map(key => {
|
Object.keys(Visibility).forEach(key => {
|
||||||
const target = Visibility[key]
|
const target = Visibility[key]
|
||||||
if (target.key === message.visibility) {
|
if (target.key === message.visibility) {
|
||||||
value = target.value
|
value = target.value
|
||||||
|
|
Loading…
Reference in New Issue