Skip to content

keepwondering/pleasure-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Functions

deepScanDir(directory, [exclude], [only], [filter])Promise.<Array.<String>>

Deep scans the given directory returning an array with strings to all of the files found in that directory.

extendConfig(scope, replacement)

Extends a configuration scope

mergeConfigWithEnv(config, prefix)*

Replaces config properties with given ENV variables. Mutates given config.

Typedefs

MDRawParserPluginString

Transforms given content

deepScanDir(directory, [exclude], [only], [filter]) ⇒ Promise.<Array.<String>>

Deep scans the given directory returning an array with strings to all of the files found in that directory.

Kind: global function
Returns: Promise.<Array.<String>> - Paths found

Param Type Default Description
directory String The directory to scan
[exclude] Array.<String> | Array.<RegExp> [/node_modules/] Paths to exclude
[only] Array.<String> | Array.<RegExp> [] If present, only paths matching the at least one of the expressions, would be included.
[filter] function Callback function called with the evaluated path as the first argument. Must return true or false

extendConfig(scope, replacement)

Extends a configuration scope

Kind: global function

Param Type Description
scope String Scope to extend
replacement function | Object Either an object to merge with the local configuration, or a function that will get called per configuration request and must return an object to merge with local found scope.

Example (Overriding a scope)

// forces to assign 4000 as the value of port in the api scopes
extendConfig('api', { port: 4000 })

// will return { api: { port: 4000, xxx: 'xValue', yyy: 'yValue' }, ui { ... } }
getConfig()

mergeConfigWithEnv(config, prefix) ⇒ *

Replaces config properties with given ENV variables. Mutates given config.

Kind: global function
Returns: * - The mutated object
Examples: ```js process.env.PLEASURE_API_MONGODB_HOST = '127.0.0.1' mergeConfigWithEnv({ api: { mongodb: { host: 'localhost', collection: 'my-project' } } })

// api: { // mongodb: { // host: '127.0.0.1', // collection: 'my-project' // } // }


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| config | <code>Object</code> |  | The configuration object |
| prefix | <code>String</code> | <code>PLEASURE</code> | Prefix of the ENV variable |

<a name="MDRawParserPlugin"></a>

## MDRawParserPlugin ⇒ <code>String</code>
Transforms given `content`

**Kind**: global typedef  
**Returns**: <code>String</code> - - New transformed source  

| Param | Type | Description |
| --- | --- | --- |
| opts | <code>Object</code> | Plugin options |
| opts.subModule | <code>Boolean</code> | Whether the plugin is being called through the main pipeline or being re-called by another plugin |
| mainOut | <code>String</code> | Bundle destination |
| directory | <code>String</code> | - |
| parentDir | <code>String</code> | `directory` to the file importing `src` |
| src | <code>String</code> | Path to the file where the `content` was loaded |
| content | <code>String</code> | The content of `src` |


* * *

&copy; 2019 Martin Rafael Gonzalez

About

utils for pleasure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published