Skip to content

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iquidus committed Feb 25, 2022
1 parent 6ac020f commit 4541bd1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
21 changes: 15 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function getPersona(address) {
if (!ADDRESS.test(address)) {
return {
success: false,
error: address + " is not a valid Ubiq/Ethereum address"
error: address + " is not a valid address"
};
} // hash the address, this will ensure minor differences in a given address
// will create major differences in the end result.
Expand All @@ -54,9 +54,14 @@ function getPersona(address) {

var odd = new _ethereumjsUtil.BN(0); // sum of odd positions

var h1 = new _ethereumjsUtil.BN(0); // sum of half 1 positions

var h2 = new _ethereumjsUtil.BN(0); // sum of half 2 positions

var positions = split.entries();
/* eslint-disable no-unused-vars */

var _iterator = _createForOfIteratorHelper(split.entries()),
var _iterator = _createForOfIteratorHelper(positions),
_step;

try {
Expand Down Expand Up @@ -91,18 +96,22 @@ function getPersona(address) {
// total male given names: 512
// total female given names: 512
// maximum potential odd sum: 4096
// maximum potential even sum: 4096

var given = '';

if (sex === 0) {
given = _names["default"].female[Math.floor(odd / 8)];
// female. use sum of even positions
given = _names["default"].female[Math.floor(even / 8)];
} else {
// male. use sum of odd positions
given = _names["default"].male[Math.floor(odd / 8)];
} // dertermine family name from a total of 4096
// maximum potential even sum: 4096
} // determine family name from a total of 4096
// maximum potential sum: 8192


var family = _names["default"].family[Math.floor(sum / 2)]; // done

var family = _names["default"].family[even]; // done

return {
success: true,
Expand Down
6 changes: 3 additions & 3 deletions dist/names.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@octano/persona",
"version": "1.2.0",
"version": "1.3.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 4541bd1

Please sign in to comment.