Socket
Socket
Sign inDemoInstall

salesforce-sanitize

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

salesforce-sanitize

Normalizes Salesforce fields names with a set of sane rules


Version published
Maintainers
1
Created
Source

Salesforce Sanitize

This function transforms objects to Salesforce keys and to JavaScript keys

API

sanitize(schema: array, onConflict? = function, input: object)

This function supports currying

Valid invocations:

sanitize([{ name: 'Custom__c', type: 'reference' }], (a, b) => a, { custom: '1234' })
const transform = sanitize([{ name: 'Custom__c', type: 'reference' }], (a, b) => a)
transform({ custom: '1234' })
const transform = sanitize([{ name: 'Custom__c', type: 'reference' }])
transform({ custom: '1234' })

Usage

const sanitize = require('@vivintsolar/salesforce-santize');
const schema = require('./path/to/jsforce/describe/schema.json');

const opportunityMapper = sanitize(schema, (left, right) => {
  console.error('Salesforce field collision!!', left, right);
  return left;
})

module.exports = (input) => {
  return opportunityMapper(input);
};

Handling Collisions

If your schema encounters a collision, you need to notify the salesforce team that they have a data problem.

Collisions should never be handled in service code as a long term solution.

In the interim, you can hard-code resolution to the "correct" field, but these hacks should be prioritized to be removed.

Keywords

FAQs

Package last updated on 02 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc