@trayio/connector-utils
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -12,2 +12,3 @@ /* eslint-disable no-console */ | ||
const convertCustomFieldsArrToObj = require('./convertCustomFieldsArrToObj'); | ||
const prettyTitle = require('./prettyTitle'); | ||
const { mustachedDDL, DDL } = require('./ddl'); | ||
@@ -81,2 +82,3 @@ const { | ||
convertCustomFieldsArrToObj, | ||
prettyTitle, | ||
@@ -83,0 +85,0 @@ // Commenting for initial release pending functionality to add paths to treatAsArray |
{ | ||
"name": "@trayio/connector-utils", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "Common utility functions used in connectors.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -135,2 +135,5 @@ # Connector-utils | ||
</dd> | ||
<dt><a href="#prettyTitle">prettyTitle(name)</a></dt> | ||
<dd><p>Create a user friendly text value.</p> | ||
</dd> | ||
</dl> | ||
@@ -539,9 +542,9 @@ | ||
Helper for generating all available JSON schema types. | ||
You may use the "exclude" parameter to exclude any unwanted type. | ||
You may use the "exclude" parameter to exclude any unwanted type. | ||
**Kind**: global function | ||
| Param | Type | Default | Description | | ||
| ------------- | ------------------- | -------------- | -------------------------------------------------------------------------------- | | ||
| exclude | <code>String</code> | <code>''</code> | String of types separated by comma to be excluded. | | ||
| Param | Type | Default | Description | | ||
| ------- | ------------------- | --------------- | -------------------------------------------------- | | ||
| exclude | <code>String</code> | <code>''</code> | String of types separated by comma to be excluded. | | ||
@@ -551,7 +554,7 @@ **Example**: | ||
```js | ||
generateAllTypes() | ||
generateAllTypes(); | ||
// returns ['string','number','object','array','boolean','null'] | ||
generateAllTypes({exclude: 'null, boolean'}) | ||
generateAllTypes({ exclude: 'null, boolean' }); | ||
@@ -569,9 +572,9 @@ // returns ['string','number','object','array'] | ||
| Param | Type | Default | Description | | ||
| ------------ | ------------------- | -------------------- | ----------------------------------------------------| | ||
| customFields | <code>Object</code> | | Array of objects that demonstrate key value pairs. | | ||
| key | <code>String</code> | | The name of the key e.g. field_name. | | ||
| value | <code>String</code> | | The value of the key e.g. field_value. | | ||
| Param | Type | Default | Description | | ||
| ------------ | ------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | ||
| customFields | <code>Object</code> | | Array of objects that demonstrate key value pairs. | | ||
| key | <code>String</code> | | The name of the key e.g. field_name. | | ||
| value | <code>String</code> | | The value of the key e.g. field_value. | | ||
| keyCase | <code>String</code> | <code>'camel'</code> | Key case formatter. Options are: `camel` (Default), `snake`, and any other value for custom cases (Recommended value: `custom`) Optional. | | ||
| returns | <code>Object</code> | | An object with key value pairs. | | ||
| returns | <code>Object</code> | | An object with key value pairs. | | ||
@@ -596,22 +599,50 @@ **Example**: | ||
convertCustomFieldsArrToObj( | ||
{ | ||
customFields, | ||
key: 'field_name', | ||
value: 'field_value', | ||
}) | ||
convertCustomFieldsArrToObj({ | ||
customFields, | ||
key: 'field_name', | ||
value: 'field_value', | ||
}); | ||
// returns { someKey: 'some value', helloWorld: 'hello world', fooBar: 'foo bar' } | ||
convertCustomFieldsArrToObj( | ||
{ | ||
customFields, | ||
key: 'field_name', | ||
value: 'field_value', | ||
keyCase: 'snake' | ||
}) | ||
convertCustomFieldsArrToObj({ | ||
customFields, | ||
key: 'field_name', | ||
value: 'field_value', | ||
keyCase: 'snake', | ||
}); | ||
// returns { some_key: 'some value', hello_world: 'hello world', foo_bar: 'foo bar' } | ||
``` | ||
<a name="prettyTitle"></a> | ||
``` | ||
## prettyTitle(name) | ||
Create a user-friendly text value. | ||
**Kind**: global function | ||
| Param | Type | Description | | ||
| ----- | ------------------- | ------------- | | ||
| name | <code>String</code> | A text value. | | ||
**Example**: | ||
```js | ||
prettyTitle('list-name'); | ||
// returns 'List name' | ||
prettyTitle('list_name'); | ||
// returns 'List name' | ||
prettyTitle('list_id_name'); | ||
//returns 'List ID name' | ||
prettyTitle('list_url_name'); | ||
// returns 'List URL name' | ||
``` |
62743
19
941
644