@adriantombu/salesforce-convert-id
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Salesforce Convert ID

npm version

Before the Salesforce API v2.5 we had both formats of ID lengths which can sometimes lead to some problems. This library aims to converts a 15 character Salesforce ID to a 18 characters Salesforce ID to address this issue.

How to use it

  • Install the library first with yarn add @adriantombu/salesforce-convert-id
  • And then import it in your script
const { salesforceConvertId } = require('@adriantombu/salesforce-convert-id')

const smallId = 'a0i1t000002i0p0';
const longId = salesforceConvertId(smallId)

'a0i1t000002i0p0AAA'

In case of an invalid ID, we juste send it back with no warning as this is not the purpose of this library

const { salesforceConvertId } = require('@adriantombu/salesforce-convert-id')

const aWrongId = 'badid';
const longId = salesforceConvertId(aWrongId)

'badid'

How to contribute

  • Clone the repository git clone git@github.com:adriantombu/salesforce-convert-id.git
  • Install the packages with yarn install
  • Modify the src/index.ts file
  • When everything's done, you can send a PR \o/

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @adriantombu/salesforce-convert-id

      Weekly Downloads

      2

      Version

      1.0.4

      License

      MIT

      Unpacked Size

      4.88 kB

      Total Files

      7

      Last publish

      Collaborators

      • adriantombu