1.0.1 • Published 7 years ago

fi-utils v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

Fi Utils Build Status

Utilities and helpers for Fi Seed based projects.

Installing

npm install --save fi-utils

Usage

const fi = require('fi-utils');

Initialization

This module exports an Object that exposes various methods:

const fi = require('fi-utils');

fi.init(config));

const mycomp = fi.component('my-component');

mycomp.configure(fi.config('my-comp-cfg'));

// ...

Configuration

An optional Object with the following parameters:

ParamTypeRequiredDefaultDescription
debugFunction\|BooleanNoFunctionCan be a Function to log with or a Boolean. If true it will use console.log.
basedirStringNopath.normalize(path.join(__dirname, '..'))Absolute path to the app's base dir.
serverdirStringNo__dirnameAbsolute path to the app's server dir.

API

MethodArgumentsDescription
initconfigThis method wil initialize the module with the provided config.
serverdirNoneReturns the configured server dir.
basedirNoneReturns the configured base dir.
includerelpath, nameRequires a file relative to the server folder.
confignameWrapper to require a config file relative to the <serverdir>/configs folder using include.
componentnameWrapper to require a component file relative to the <serverdir>/components folder using include.