MCPcopy Create free account
hub / github.com/codecombat/codecombat / sortClan

Function sortClan

app/core/store/modules/clans.js:5–13  ·  view source on GitHub ↗
(clns)

Source from the content-addressed store, hash-verified

3const _ = require('lodash')
4
5const sortClan = (clns) => {
6 const clans = clns.filter(c => c)
7 const firstClassClan = _.findIndex(clans, (clan) => clan?.slug?.startsWith('autoclan-classroom'))
8 const classClans = clans.filter((clan) => clan?.slug?.startsWith('autoclan-classroom'))
9 const otherClans = clans.filter((clan) => !clan?.slug?.startsWith('autoclan-classroom'))
10 classClans.sort((a, b) => b._id.localeCompare(a._id))
11 otherClans.splice(firstClassClan, 0, ...classClans)
12 return otherClans
13}
14
15export default {
16 namespaced: true,

Callers 1

myClansFunction · 0.85

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected