1import { createInitialTypes, SerialBuffer } from 'eosjs/dist/eosjs-serialize';
2convertName(name){
3 const builtinTypes = createInitialTypes()
4 const typeUint64 = builtinTypes.get("uint64")
5 const typeName = builtinTypes.get("name")
6 var buffer = new SerialBuffer({ textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });
7
8 typeName.serialize(buffer, name)
9 return typeUint64.deserialize(buffer)
10}
11
12console.log(convertName("hossainiiiir"));
13