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

Function anonymizingUser

app/core/utils.js:63–68  ·  view source on GitHub ↗
(user)

Source from the content-addressed store, hash-verified

61}
62
63const anonymizingUser = function (user) {
64 const id = (user != null ? user.id : undefined) != null ? (user != null ? user.id : undefined) : user
65 const hashString = str => // hash * 33 + c
66 (__range__(0, str.length, false).map((i) => str.charCodeAt(i))).reduce((hash, char) => ((hash << 5) + hash) + char, 5381)
67 return $.i18n.t('general.player') + ' ' + (Math.abs(hashString(id)) % 10000)
68}
69
70const clone = function (obj) {
71 if ((obj === null) || (typeof (obj) !== 'object')) { return obj }

Callers

nothing calls this directly

Calls 1

hashStringFunction · 0.70

Tested by

no test coverage detected