![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
loader-cache
Advanced tools
Readme
Register loader functions that dynamically read, parse or otherwise transform file contents when the name of the loader matches a file extension. You can also compose loaders from other loaders.
var LoaderCache = require('loader-cache');
var loaders = new LoaderCache();
// register a loader for reading files
loaders.register('read', function(fp) {
return fs.readFileSync(fp, 'utf8');
});
// register a loader for parsing YAML
loaders.register('yaml', function(fp) {
return YAML.safeLoad(fp);
});
// create a loader from any combination of other
// registered loaders and functions.
loaders.register('dataLoader', ['read', 'yaml'], function(data) {
if (!data) throw new Error('no data!');
return data;
});
// pass a loader stack or the name of a loader to `.compose()`
// to create the actual function to be used for loading
var fn = loaders.compose('dataLoader');
var data = fn('config.yml');
Install with npm
$ npm i loader-cache --save
(Table of contents generated by [verb])
Create a new instance of LoaderCache
Example
var LoaderCache = require('loader-cache');
var loaders = new LoaderCache();
Register an iterator function of the given type
. Types typically
represent a kind of flow-control, like sync
, promise
, stream
,
async
etc.
Params
type
{String}options
{Object}fn
{Function}: The actual iterator function.returns
{Object}Params
name
{String}options
{Object}fns
{Function|Array}: One or more loader functions or names of other registered loaders.returns
{Array}Example
// create a loader from other loaders.
app.loader('foo', ['bar', 'baz']);
// pass a function
app.loader('foo', function(patterns, options) {
return glob.sync(patterns, options);
});
// combination
app.loader('foo', ['bar', 'baz'], function(patterns, options) {
return glob.sync(patterns, options);
});
Params
name
{String}: The name of the loader stack to use.options
{Object}stack
{Array|Function}: Additional loader names or functions.returns
{Function}Example
var fn = app.compose('foo');
// load some files
var files = fn('*.txt');
Install dev dependencies:
$ npm i -d && npm test
Please help improve code coverage by adding unit tests.
-----------------|-----------|-----------|-----------|-----------|
File | % Stmts |% Branches | % Funcs | % Lines |
-----------------|-----------|-----------|-----------|-----------|
loader-cache/ | 91.27 | 82.35 | 85.71 | 92.5 |
index.js | 91.27 | 82.35 | 85.71 | 92.5 |
-----------------|-----------|-----------|-----------|-----------|
All files | 91.27 | 82.35 | 85.71 | 92.5 |
-----------------|-----------|-----------|-----------|-----------|
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on June 29, 2015.
FAQs
Register loader functions that dynamically read, parse or otherwise transform file contents when the name of the loader matches a file extension. You can also compose loaders from other loaders.
The npm package loader-cache receives a total of 190 weekly downloads. As such, loader-cache popularity was classified as not popular.
We found that loader-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.