{"_id":"@bonfida/borsh-js","_rev":"1-38c903a915f1aae22301b4e26faf2e44","name":"@bonfida/borsh-js","dist-tags":{"latest":"0.3.1"},"versions":{"0.3.1":{"name":"@bonfida/borsh-js","version":"0.3.1","description":"Binary Object Representation Serializer for Hashing","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc -p ./tsconfig.json","test":"jest test --runInBand","fuzz":"jsfuzz borsh-ts/test/fuzz/borsh-roundtrip.js borsh-ts/test/fuzz/corpus/","dev":"yarn build -w","pretest":"yarn build","lint":"eslint borsh-ts/**/*.ts","fix":"eslint borsh-ts/**/*.ts --fix"},"repository":{"type":"git","url":"git+https://github.com/nearprotocol/borsh.git"},"keywords":["serializer","binary","serializer","deserializer","consistency","determenistic"],"author":{"name":"Near Inc"},"license":"Apache-2.0","bugs":{"url":"https://github.com/nearprotocol/borsh/issues"},"homepage":"https://github.com/nearprotocol/borsh#readme","devDependencies":{"@types/babel__core":"^7.1.2","@types/babel__template":"^7.0.2","@types/node":"^12.7.3","@typescript-eslint/eslint-plugin":"^2.18.0","@typescript-eslint/parser":"^2.18.0","bs58":"^4.0.0","eslint":"^6.5.1","jest":"^26.0.1","js-sha256":"^0.9.0","jsfuzz":"^1.0.14","typescript":"^3.6.2"},"dependencies":{"@types/bn.js":"^4.11.5","bn.js":"^5.0.0","bs58":"^4.0.0","text-encoding-utf-8":"^1.0.2"},"gitHead":"4f000b15d09dda16e86caba66641ac1d27573056","_id":"@bonfida/borsh-js@0.3.1","_nodeVersion":"16.0.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-414D1c2YNw9Pr7j+2SXbAEB2FCCKv5I+J/nX1Jw2yCE4st2heQ4pB3BdMoTjxPnBWwk8Bz060OUoLz+U7vEMBQ==","shasum":"89c522f94db36bb7b3a85be549fbf32738cf5738","tarball":"https://registry.npmjs.org/@bonfida/borsh-js/-/borsh-js-0.3.1.tgz","fileCount":45,"unpackedSize":80250,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgjFY+CRA9TVsSAnZWagAA+xMP/0niO6AhwWN4KUKpasaH\nZ2nTs9nqnh+2vICplnZPj2bOoQ7Dx6C7UJPnua+j6K3LK4CjISNCOqLUSQUv\nOpp323dvnYqkfJ9/nUYF2BgF5DscZDAKdtQB7jaKR1yrvOTSMYX2Kcxavmh2\nkfuU2PG86Xzj6uDCYTtJKur5qZ+Yz9xPDmfB6uD1KW8E9gln7HPIGTVnynnW\nbU8oG/MaSsFWT3CbFkA07kmhuzDm8IpGczJk6zxFvMkOcgQ0Aj76OcZAVxRM\n+o8lc8wo8iQuQDzwa8UxPXh8H31qddJNWvIesJCdlamnOKUHd1Wpj8X0RxiY\nTPUYzAsZWuSUxH8YtI1Rh+FIUGU96hvXSMw1GJjyLN4DUrdEY4VxR5I1yvvC\nSeJHGxhacJuK989e+RLJqzdZvrxCtyYkGUUMftD26jUpmdSojB07K1NEHp7v\nK5cXS7lojBFWzJeD9xASE2N4HBmU00Ok4F1y2DziR9h/HLB9FtUHqi6Uah4R\n+IYCnmfMfO28fLVBBFyudfRfPRaU3IW6Q/J+rKtrrMk7po8RhdOGlKO2Ugiz\nV2X/TKjOta4l6/I6ZcUP5ds6Ab4gcSCpatlHsOGcDhdpebFeMLV2UCjtyNiz\n7x1/FrJtE027MiR0jHfzUVAeX3E2pfX9bK9FmH17O5lqZz9qAyGCJpnOWobP\n2UJk\r\n=j/jt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHcEDi/2+qzazVlYcgF3gmqsfQDXgV2MrN4R8WaDBV3pAiAtG3EbbV9Ho24qcuFd0BGXDkP9g019E8PdFINj+83y8Q=="}]},"_npmUser":{"name":"bonfida","email":"contact@bonfida.com"},"directories":{},"maintainers":[{"name":"bonfida","email":"contact@bonfida.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/borsh-js_0.3.1_1619809853860_0.9783567469974379"},"_hasShrinkwrap":false}},"time":{"created":"2021-04-30T19:10:53.816Z","0.3.1":"2021-04-30T19:10:54.096Z","modified":"2022-04-04T20:06:08.963Z"},"maintainers":[{"name":"bonfida","email":"contact@bonfida.com"}],"description":"Binary Object Representation Serializer for Hashing","homepage":"https://github.com/nearprotocol/borsh#readme","keywords":["serializer","binary","serializer","deserializer","consistency","determenistic"],"repository":{"type":"git","url":"git+https://github.com/nearprotocol/borsh.git"},"author":{"name":"Near Inc"},"bugs":{"url":"https://github.com/nearprotocol/borsh/issues"},"license":"Apache-2.0","readme":"# Borsh JS\n\n[![Project license](https://img.shields.io/badge/license-Apache2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Project license](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Discord](https://img.shields.io/discord/490367152054992913?label=discord)](https://discord.gg/Vyp7ETM)\n[![Travis status](https://travis-ci.com/near/borsh.svg?branch=master)](https://travis-ci.com/near/borsh-js)\n[![NPM version](https://img.shields.io/npm/v/borsh.svg?style=flat-square)](https://npmjs.com/borsh)\n[![Size on NPM](https://img.shields.io/bundlephobia/minzip/borsh.svg?style=flat-square)](https://npmjs.com/borsh)\n\n**Borsh JS** is an implementation of the [Borsh] binary serialization format for\nJavaScript and TypeScript projects.\n\nBorsh stands for _Binary Object Representation Serializer for Hashing_. It is meant to be used in security-critical projects as it prioritizes consistency,\nsafety, speed, and comes with a strict specification.\n\n## Examples\n### Serializing an object\n```javascript\nconst value = new Test({ x: 255, y: 20, z: '123', q: [1, 2, 3] });\nconst schema = new Map([[Test, { kind: 'struct', fields: [['x', 'u8'], ['y', 'u64'], ['z', 'string'], ['q', [3]]] }]]);\nconst buffer = borsh.serialize(schema, value);\n```\n\n### Deserializing an object\n```javascript\nconst newValue = borsh.deserialize(schema, Test, buffer);\n```\n\n## Type Mappings\n\n| Borsh                 | TypeScript     |\n|-----------------------|----------------|\n| `u8` integer          | `number`       |\n| `u16` integer         | `number`       |\n| `u32` integer         | `number`       |\n| `u64` integer         | `BN`           |\n| `u128` integer        | `BN`           |\n| `u256` integer        | `BN`           |\n| `u512` integer        | `BN`           |\n| `f32` float           | N/A            |\n| `f64` float           | N/A            |\n| fixed-size byte array | `Uint8Array`   |\n| UTF-8 string          | `string`       |\n| option                | `null` or type |\n| map                   | N/A            |\n| set                   | N/A            |\n| structs               | `any`          |\n\n## Contributing\n\nInstall dependencies:\n```bash\nyarn install\n```\n\nContinuesly build with:\n```bash\nyarn dev\n```\n\nRun tests:\n```bash\nyarn test\n```\n\nRun linter\n```bash\nyarn lint\n```\n## Publish\n\nPrepare `dist` version by running:\n```bash\nyarn build\n```\n\nWhen publishing to npm use [np](https://github.com/sindresorhus/np).\n\n# License\nThis repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).\nSee [LICENSE-MIT](LICENSE-MIT.txt) and [LICENSE-APACHE](LICENSE-APACHE) for details.\n\n[Borsh]:          https://borsh.io\n","readmeFilename":"README.md"}