{"_id":"@blockchainhub/ican","_rev":"6-825661872339b8a16570d945b4047abd","name":"@blockchainhub/ican","dist-tags":{"latest":"0.4.3"},"versions":{"0.2.1":{"name":"@blockchainhub/ican","version":"0.2.1","keywords":["ican","bcan","international","crypto","account","number","crytography","format","convert"],"author":{"name":"CRYPTO ▪ HUB®"},"license":"CORE","_id":"@blockchainhub/ican@0.2.1","maintainers":[{"name":"coreorg","email":"rastislav@wallit.eu"}],"homepage":"https://github.com/bchainhub/ican.js#readme","bugs":{"url":"https://github.com/bchainhub/ican.js/issues"},"dist":{"shasum":"9b22bcd308b623bfe2fb60ce155dead6dc32ef41","tarball":"https://registry.npmjs.org/@blockchainhub/ican/-/ican-0.2.1.tgz","fileCount":5,"integrity":"sha512-aLYbJA5/Rm2uwjvdne85oa/O5u84srzWX9wTSY1R1J+YhqZ3WnahY5XnyLum2B1kwWJ1lnjqVVeG+ZiCxTTIvg==","signatures":[{"sig":"MEYCIQDKAPLzJYY8zRBU8XQPK2Tles/Ghxihhh6g+dNsZLFyiAIhAIGMf1Yn5tZaRNRsrJCSPhLGpE4raa9b1vysBGMXFUvD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26744},"main":"src/index.js","types":"src/index.d.ts","engines":{"node":">= 8"},"gitHead":"8b21e88e9ee66ea0391325edcf271d7f4dba19fe","private":false,"scripts":{"test":"npm run unit && npm run standard 'src/index.js'","unit":"tape test/*.js","build":"cp ican.js src/index.js && standard --fix 'src/index.js'","gitdiff":"npm run build && git diff --exit-code","standard":"standard 'src/index.js'"},"_npmUser":{"name":"coreorg","email":"rastislav@wallit.eu"},"repository":{"url":"git+https://github.com/bchainhub/ican.js.git","type":"git"},"_npmVersion":"8.19.4","description":"A JavaScript library to validate, format, and convert International Crypto Account Numbers (ICAN) and Basic Crypto Account Numbers (BCAN).","directories":{},"_nodeVersion":"16.20.2","_hasShrinkwrap":false,"devDependencies":{"tape":"^5.6.1","standard":"^17.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ican_0.2.1_1698087661598_0.8398456719469944","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"@blockchainhub/ican","version":"0.3.0","keywords":["ican","bcan","international","crypto","account","number","crytography","format","convert"],"author":{"name":"Blockchain Hub"},"license":"CORE","_id":"@blockchainhub/ican@0.3.0","maintainers":[{"name":"coreorg","email":"rastislav@wallit.eu"}],"homepage":"https://github.com/bchainhub/ican.js#readme","bugs":{"url":"https://github.com/bchainhub/ican.js/issues"},"dist":{"shasum":"02cc2897379c041abc1bded75c357e476cc79eef","tarball":"https://registry.npmjs.org/@blockchainhub/ican/-/ican-0.3.0.tgz","fileCount":5,"integrity":"sha512-rUk7N+Z/qXHmmgcv3TDClx1UCR2fSFyTw5h8Lq7NE/JfhgjQ1aBmBCgKRyL4zInBm79h6VxadDkUsXsW4diDNg==","signatures":[{"sig":"MEQCIAtXjSdM0K3DzhuIX33XVEVMOOEslKFA8rEFPaSdN87bAiApDpx33FaZ1PYJVvsbvSO/F/9zTBkSi2XH439FUMt2XA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":27986},"main":"src/index.js","types":"src/index.d.ts","engines":{"node":">= 8"},"gitHead":"78d8e4f5d6281362692d39b8e178c033934c5791","private":false,"scripts":{"test":"npm run unit && npm run standard 'src/index.js'","unit":"tape test/*.js","build":"cp ican.js src/index.js && standard --fix 'src/index.js'","gitdiff":"npm run build && git diff --exit-code","standard":"standard 'src/index.js'"},"_npmUser":{"name":"coreorg","email":"rastislav@wallit.eu"},"repository":{"url":"git+https://github.com/bchainhub/ican.js.git","type":"git"},"_npmVersion":"8.19.4","description":"A JavaScript library to validate, format, and convert International Crypto Account Numbers (ICAN) and Basic Crypto Account Numbers (BCAN).","directories":{},"_nodeVersion":"16.20.2","_hasShrinkwrap":false,"devDependencies":{"tape":"^5.7.2","standard":"^17.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ican_0.3.0_1702590356832_0.11405953042640982","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"@blockchainhub/ican","version":"0.4.0","keywords":["ican","bcan","international","crypto","account","number","crytography","format","convert"],"author":{"name":"Blockchain Hub"},"license":"CORE","_id":"@blockchainhub/ican@0.4.0","maintainers":[{"name":"coreorg","email":"rastislav@wallit.eu"}],"homepage":"https://github.com/bchainhub/ican.js#readme","bugs":{"url":"https://github.com/bchainhub/ican.js/issues"},"dist":{"shasum":"0ef6a3a18cda1d01c806b4044ea7c0885cf07d72","tarball":"https://registry.npmjs.org/@blockchainhub/ican/-/ican-0.4.0.tgz","fileCount":5,"integrity":"sha512-ONlRrDZclmghI+qNDTdzhixmaYs8bLBe9WWm4OsztoGVJ7N4FwHknei5Rbu+cjOUrOD800GBEGY0INf2bdyrbQ==","signatures":[{"sig":"MEYCIQCwF/7lsftQuk23NOx3Bc7wzE5AgZc7mvgRGrn4a43zpwIhALZxB0ym/flgRNiKmS9/4BOLbl1CF2+0k/er40O3tKNc","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@blockchainhub%2fican@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":29090},"main":"src/index.js","types":"src/index.d.ts","engines":{"node":">= 8"},"gitHead":"4bdc14d00a0257a404b1e61ff675f1a78ce858b9","private":false,"scripts":{"test":"npm run unit && npm run standard 'src/index.js'","unit":"tape test/*.js","build":"cp ican.js src/index.js && standard --fix 'src/index.js'","gitdiff":"npm run build && git diff --exit-code","standard":"standard 'src/index.js'"},"_npmUser":{"name":"coreorg","email":"rastislav@wallit.eu"},"repository":{"url":"git+https://github.com/bchainhub/ican.js.git","type":"git"},"_npmVersion":"10.5.0","description":"A JavaScript library to validate, format, and convert International Crypto Account Numbers (ICAN) and Basic Crypto Account Numbers (BCAN).","directories":{},"_nodeVersion":"18.20.2","_hasShrinkwrap":false,"devDependencies":{"tape":"^5.7.5","standard":"^17.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ican_0.4.0_1715688153611_0.021490467135832247","host":"s3://npm-registry-packages"}},"0.4.1":{"name":"@blockchainhub/ican","version":"0.4.1","keywords":["ican","bcan","international","crypto","account","number","crytography","format","convert"],"author":{"name":"Blockchain Hub"},"license":"CORE","_id":"@blockchainhub/ican@0.4.1","maintainers":[{"name":"coreorg","email":"rastislav@wallit.eu"}],"homepage":"https://github.com/bchainhub/ican.js#readme","bugs":{"url":"https://github.com/bchainhub/ican.js/issues"},"dist":{"shasum":"8b13c92ea14540d0f68a302570e92decafd4a037","tarball":"https://registry.npmjs.org/@blockchainhub/ican/-/ican-0.4.1.tgz","fileCount":5,"integrity":"sha512-zNjXP5YxSUejEKqQ2DnTM0c0Y0Es2O9AXm8uXe4gdcXxdZYgMLbk5iGn4f9UbWrQW7pi1j3a62DGVJJz+F4nMg==","signatures":[{"sig":"MEUCIHM/8gnqssA7oauu4OmCS9bziQLXE0/ACdSkkYaHBXEXAiEAkix69uwMLHn6WE8HSp13gVSCgOT2n3qgDU15hF56OO8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@blockchainhub%2fican@0.4.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":28775},"main":"src/index.js","types":"src/index.d.ts","engines":{"node":">= 8"},"gitHead":"3153492a52354d9b782dc398d60ffd6303641691","private":false,"scripts":{"test":"npm run unit && npm run standard 'src/index.js'","unit":"tape test/*.js","build":"cp ican.js src/index.js && standard --fix 'src/index.js'","gitdiff":"npm run build && git diff --exit-code","standard":"standard 'src/index.js'"},"_npmUser":{"name":"coreorg","email":"rastislav@wallit.eu"},"repository":{"url":"git+https://github.com/bchainhub/ican.js.git","type":"git"},"_npmVersion":"10.7.0","description":"A JavaScript library to validate, format, and convert International Crypto Account Numbers (ICAN) and Basic Crypto Account Numbers (BCAN).","directories":{},"_nodeVersion":"18.20.4","_hasShrinkwrap":false,"devDependencies":{"tape":"^5.7.5","standard":"^17.1.0"},"_npmOperationalInternal":{"tmp":"tmp/ican_0.4.1_1722546895861_0.8920030834725854","host":"s3://npm-registry-packages"}},"0.4.2":{"name":"@blockchainhub/ican","version":"0.4.2","keywords":["ican","bcan","international","crypto","account","number","crytography","format","convert"],"author":{"name":"Blockchain Hub"},"license":"CORE","_id":"@blockchainhub/ican@0.4.2","maintainers":[{"name":"coreorg","email":"rastislav@wallit.eu"}],"homepage":"https://github.com/bchainhub/ican.js#readme","bugs":{"url":"https://github.com/bchainhub/ican.js/issues"},"dist":{"shasum":"cd081c6999d628b9fbed9775e174c176b5345bbc","tarball":"https://registry.npmjs.org/@blockchainhub/ican/-/ican-0.4.2.tgz","fileCount":5,"integrity":"sha512-v/AKSAP+gsKGZdvOKYO52cp6lYf73PcjNKUNWA1ZREQP8Wkbmx6uQqjvInbeHD4fSnFypePjWci+2Hy+fk9ZuQ==","signatures":[{"sig":"MEUCIEKdaLnda+2iypxJC2fFw3QO2xB/KpUXfYzTg/dK0nmhAiEA0OEsgpQ9wvxCeRvtgX6pjbJWp4O3vnzIDvCqCFLdxX0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@blockchainhub%2fican@0.4.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":27145},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">= 8"},"gitHead":"a493edfc624d76e9b4cffc3ad1a866dc765ffbf4","private":false,"scripts":{"test":"npm run unit && npm run standard","unit":"npm run build && tape test/*.js","build":"mkdir -p dist && cp ican.js dist/index.js && cp ican.d.ts dist/index.d.ts","gitdiff":"npm run build && git diff --exit-code","standard":"npm run build && npx standard 'dist/**/*.js'"},"_npmUser":{"name":"coreorg","email":"rastislav@wallit.eu"},"repository":{"url":"git+https://github.com/bchainhub/ican.js.git","type":"git"},"_npmVersion":"10.8.2","description":"A JavaScript library to validate, format, and convert International Crypto Account Numbers (ICAN) and Basic Crypto Account Numbers (BCAN).","directories":{},"_nodeVersion":"20.18.1","_hasShrinkwrap":false,"devDependencies":{"tape":"^5.9.0","standard":"^17.1.2"},"_npmOperationalInternal":{"tmp":"tmp/ican_0.4.2_1733586853078_0.6520952083956868","host":"s3://npm-registry-packages"}},"0.4.3":{"name":"@blockchainhub/ican","version":"0.4.3","description":"A JavaScript library to validate, format, and convert International Crypto Account Numbers (ICAN) and Basic Crypto Account Numbers (BCAN).","keywords":["ican","bcan","international","crypto","account","number","crytography","format","convert"],"devDependencies":{"standard":"^17.1.2","tape":"^5.9.0"},"scripts":{"build":"mkdir -p dist && cp ican.js dist/index.js && cp ican.d.ts dist/index.d.ts","gitdiff":"npm run build && git diff --exit-code","test":"npm run unit && npm run standard","unit":"npm run build && tape test/*.js","standard":"npm run build && npx standard 'dist/**/*.js'"},"main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/bchainhub/ican.js.git"},"author":{"name":"Blockchain Hub"},"license":"CORE","private":false,"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"engines":{"node":">= 8"},"gitHead":"4cfc33f9518837be5a69aa0c877a6cedb591bbd4","_id":"@blockchainhub/ican@0.4.3","bugs":{"url":"https://github.com/bchainhub/ican.js/issues"},"homepage":"https://github.com/bchainhub/ican.js#readme","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-csAgnDCaG3lt+TxExFPb1sS1oDzZGp0oXmHVdxjJ3nu2S0DgexBGeseY66VUlPitSCtM4r3uMoV6h1tLkFOewA==","shasum":"ed99cf7563fc7b129db2f696500f6417eaf2154d","tarball":"https://registry.npmjs.org/@blockchainhub/ican/-/ican-0.4.3.tgz","fileCount":5,"unpackedSize":34358,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@blockchainhub%2fican@0.4.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDxZWgxt/s8Fjyb5Y4SizvgIphKdjO2A6M+gnQ3uIsoHgIgTcBy4bhDNRpD25X9iURfVLgb9goFYrZsk7VrXwjsmwg="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:41a09d35-cc48-4f9d-b98d-f6764fedbbac"}},"directories":{},"maintainers":[{"name":"coreorg","email":"rastislav@wallit.eu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ican_0.4.3_1768063206550_0.7452938581411321"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-23T19:01:01.490Z","modified":"2026-01-10T16:40:07.107Z","0.2.1":"2023-10-23T19:01:01.748Z","0.3.0":"2023-12-14T21:45:57.012Z","0.4.0":"2024-05-14T12:02:33.842Z","0.4.1":"2024-08-01T21:14:56.058Z","0.4.2":"2024-12-07T15:54:13.254Z","0.4.3":"2026-01-10T16:40:06.696Z"},"bugs":{"url":"https://github.com/bchainhub/ican.js/issues"},"author":{"name":"Blockchain Hub"},"license":"CORE","homepage":"https://github.com/bchainhub/ican.js#readme","keywords":["ican","bcan","international","crypto","account","number","crytography","format","convert"],"repository":{"type":"git","url":"git+https://github.com/bchainhub/ican.js.git"},"description":"A JavaScript library to validate, format, and convert International Crypto Account Numbers (ICAN) and Basic Crypto Account Numbers (BCAN).","maintainers":[{"name":"coreorg","email":"rastislav@wallit.eu"}],"readme":"\n# ican.js\n\nICAN and BCAN validation, formatting, and conversion in JavaScript.\n\nICAN.js adheres to the [ISO 13616 IBAN Registry technical specification](https://www.swift.com/standards/data-standards/iban) and includes support for Crypto addresses, including distinctions for mainnets, testnets, and enterprise networks.\n\n## Usage\n\nICAN.js is compatible with both CommonJS and AMD module definitions.\n\n### NPM\n\nYou can install [@blockchainhub/ican from NPM](https://www.npmjs.com/package/@blockchainhub/ican) using Yarn, NPM, or another tool.\n\n> NPM\n\n```sh\nnpm install @blockchainhub/ican\n```\n\n> Bun\n\n```sh\nbun add @blockchainhub/ican\n```\n\n### In Node.js\n\n```js\nconst ICAN = require('@blockchainhub/ican');\nconsole.log(ICAN.isValid('hello world')); // false\nconsole.log(ICAN.isValid('BE68539007547034')); // true\n```\n\n### In the Browser\n\nYou can use a module loader (AMD or CommonJS) or access it directly through the global `ICAN` object:\n\n```html\n<script src=\"ican.js\"></script>\n<script>\n    // The API is now accessible from the window.ICAN global object\n    console.log(ICAN.isValid('hello world')); // false\n    console.log(ICAN.isValid('BE68539007547034')); // true\n</script>\n```\n\n### With ESM\n\nUsing ICAN.js with React is straightforward:\n\n```ts\nimport ICAN from '@blockchainhub/ican';\nconsole.log(ICAN.isValid('hello world')); // false\nconsole.log(ICAN.isValid('BE68539007547034')); // true\n```\n\n## API\n\n### Methods\n\n#### `isValid(ican, onlyCrypto)`\n\n- Validates an ICAN.\n- **Parameters**:\n  - `ican`: The ICAN to validate.\n  - `onlyCrypto`: (Optional) Restrict validation to crypto definitions. Possible values:\n    - `true`: Include all crypto networks.\n    - `false`: Exclude crypto networks.\n    - `'main'` or `'mainnet'`: Mainnets.\n    - `'test'` or `'testnet'`: Testnets.\n    - `'enter'` or `'enterprise'`: Enterprise networks.\n\n#### `toBCAN(ican, separator)`\n\n- Converts an ICAN to its country-specific BCAN representation.\n- **Parameters**:\n  - `ican`: The ICAN to convert.\n  - `separator`: (Optional) The separator to use between BCAN blocks (default is `' '`).\n\n#### `fromBCAN(countryCode, bcan)`\n\n- Converts a BCAN to an ICAN for a specific country.\n- **Parameters**:\n  - `countryCode`: The country code of the BCAN.\n  - `bcan`: The BCAN to convert.\n\n#### `isValidBCAN(countryCode, bcan, onlyCrypto)`\n\n- Validates a BCAN.\n- **Parameters**:\n  - `countryCode`: The country code of the BCAN.\n  - `bcan`: The BCAN to validate.\n  - `onlyCrypto`: (Optional) Restrict validation to crypto definitions. Accepts the same values as `isValid` (`'main'`/`'mainnet'`, `'test'`/`'testnet'`, `'enter'`/`'enterprise'`).\n\n#### `printFormat(ican, separator)`\n\n- Formats an ICAN for display with separators.\n- **Parameters**:\n  - `ican`: The ICAN to format.\n  - `separator`: (Optional) The separator to use (default is `' '`).\n\n#### `electronicFormat(ican)`\n\n- Converts an ICAN to its electronic format (removing non-alphanumeric characters and uppercasing).\n\n#### `shortFormat(ican, separator, frontCount, backCount, strength)`\n\n- Produces a shortened version of the ICAN with a custom separator.\n- **Parameters**:\n  - `ican`: The ICAN to shorten.\n  - `separator`: (Optional) The separator to use (default is `'…'`).\n  - `frontCount`: (Optional) Number of characters to display at the start (default is `4`).\n  - `backCount`: (Optional) Number of characters to display at the end and middle parts (default is `4`).\n  - `strength`: (Optional) Number of elements to show, from 1 to 4 (default is `2`):\n    - `1`: Show only endings (last `backCount` characters), e.g., `…0123`.\n    - `2`: Show beginning (`frontCount`) and end (`backCount`), e.g., `CB12…0123`.\n    - `3`: Show beginning (`frontCount`), middle (`backCount`), and end (`backCount`), e.g., `CB12…5B35…0123`. The middle is positioned in the earlier-middle area of the available space.\n    - `4`: Show extended beginning (2×`frontCount`), middle (`backCount`), and end (`backCount`), e.g., `CB714787…5B35…0123`. Uses the same middle position as strength 3.\n- **Returns**: The shortened ICAN. Returns the full ICAN if:\n  - There are not enough characters to compose the requested format\n  - Parts would overlap with each other\n  - Parts would touch each other (no delimiter needed, so full string is shown)\n\n- **Edge Cases**:\n  - If parts touch (front reaches middle, or middle reaches end), the continuous section is shown without an additional delimiter between them\n  - Invalid `strength` values (< 1 or > 4) default to `2`\n  - The middle position is calculated consistently for strengths 3 and 4, ensuring the same middle segment is shown in both cases\n\n- **Examples**:\n\n```js\nconst ican = 'CB7147879011EA207DF5B35A24CA6F0859DCFB145999'\n\nICAN.shortFormat(ican)                              // 'CB71…5999' (default: strength 2)\nICAN.shortFormat(ican, '…', 4, 4, 1)                // '…5999' (endings only)\nICAN.shortFormat(ican, '…', 4, 4, 2)                // 'CB71…5999' (beginning + end)\nICAN.shortFormat(ican, '…', 4, 4, 3)                // 'CB71…5B35…5999' (beginning + middle + end)\nICAN.shortFormat(ican, '…', 4, 4, 4)                // 'CB714787…5B35…5999' (extended + middle + end)\nICAN.shortFormat(ican, '-', 4, 4, 3)                // 'CB71-5B35-5999' (custom separator)\nICAN.shortFormat(ican, '…', 6, 6, 3)                // 'CB7147…F5B35A…145999' (custom counts)\n```\n\n### Variables\n\n- `ican`: An International Crypto Account Number.\n- `bcan`: A country-specific Base Crypto Account Number.\n- `countryCode`: The country code for the BCAN.\n- `separator`: A separator to format ICAN or BCAN strings.\n- `onlyCrypto`: A filter for crypto validation. Accepts `true`, `false`, `'main'`/`'mainnet'`, `'test'`/`'testnet'`, or `'enter'`/`'enterprise'`.\n- `frontCount` and `backCount`: Define how many characters to include in the `shortFormat` method.\n- `strength`: Controls how many elements to show in `shortFormat` (1-4, default is 2).\n\n## Contributions\n\nWe welcome contributions in any form. Here's how you can help:\n\n1. Fork [this repository](/fork).\n2. Open a [pull request](/pulls).\n3. Support us with some Øres / ₡ores: [cb7147879011ea207df5b35a24ca6f0859dcfb145999](https://blockindex.net/address/cb7147879011ea207df5b35a24ca6f0859dcfb145999).\n4. Star this repository.\n\n## License\n\nLicensed under the [CORE](LICENSE) License.\n","readmeFilename":"README.md"}