@trayio/connector-utils
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -18,2 +18,4 @@ const deepMapKeys = require('./deepMapKeys'); | ||
} = require('./errors'); | ||
const deprecationWarning = | ||
'Nested use of this method is deprecated. Please import from top level of the library.'; | ||
@@ -36,10 +38,30 @@ module.exports = { | ||
deepMap: { | ||
deepMapKeys, | ||
removeEmptyObjects, | ||
deepMapKeys: (collection, iteratee) => { | ||
console.warn(`deepMapKeys: ${deprecationWarning}`); | ||
return deepMapKeys(collection, iteratee); | ||
}, | ||
removeEmptyObjects: collection => { | ||
console.warn(`removeEmptyObjects: ${deprecationWarning}`); | ||
return removeEmptyObjects(collection); | ||
}, | ||
}, | ||
schema: { | ||
lookup, | ||
mustachedDDL, | ||
DDL, | ||
lookup: (message, step_settings = {}) => { | ||
console.warn(`lookup: ${deprecationWarning}`); | ||
return lookup(message, step_settings); | ||
}, | ||
mustachedDDL: (object, text, value, isInteger = false) => { | ||
console.warn(`mustachedDDL: ${deprecationWarning}`); | ||
return mustachedDDL(object, text, value, isInteger); | ||
}, | ||
DDL: (object, textPath, valuePath) => { | ||
console.warn(`DDL: ${deprecationWarning}`); | ||
return DDL(object, textPath, valuePath); | ||
}, | ||
}, | ||
deepMapKeys, | ||
removeEmptyObjects, | ||
lookup, | ||
mustachedDDL, | ||
DDL, | ||
// Commenting for initial release pending functionality to add paths to treatAsArray | ||
@@ -46,0 +68,0 @@ // xml: { |
{ | ||
"name": "@trayio/connector-utils", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Common utility functions used in connectors.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
# Connector-utils | ||
Common utility functions used in connectors. | ||
## Usage | ||
## Installation | ||
TODO: add usage guide | ||
The `connector-utils` package will be inherently included as part of a new connector scaffold (as part of the Trayio yeoman generator). | ||
When adding the package as part of an existing connector, first ensure you have the appropriate `.npmrc` present, then in your terminal, run: | ||
``` | ||
npm i @trayio/connector-utils --save | ||
``` | ||
## Basic Usage | ||
To require the package, require as `@trayio/connector-utils`: | ||
``` | ||
const utils = require('@trayio/connector-utils') | ||
``` | ||
This will give full access to the library. We can then reference utilities such as `UserInputError` by using: | ||
``` | ||
utils.error.UserInputError('custom error message') | ||
``` | ||
A better usage alternative is to use destructuring, as in the example: | ||
``` | ||
const { UserInputError } = require('@trayio/connector-utils/lib/errors') | ||
``` | ||
A full breakdown of available utilities is included in the documentation below. | ||
Please be sure to add any discovered issues or improvement recommendations to the `Issues` tab of this repo. | ||
# Documentation | ||
@@ -305,2 +330,2 @@ | ||
| --- | --- | --- | | ||
| collection | <code>Object</code> | The collection from which to remove empty objects. | | ||
| collection | <code>Object</code> | The collection from which to remove empty objects. | |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
30198
511
331
1