Sha256: 4f89df08339feced0932b0bb8eaa68d742d754d55a73f7d7d2aacdbbdb1f6d44

Contents?: true

Size: 1.66 KB

Versions: 26

Compression:

Stored size: 1.66 KB

Contents

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.build = void 0;
const onlyCountsSync = (state) => {
    return state.counts;
};
const groupsSync = (state) => {
    return state.groups;
};
const defaultSync = (state) => {
    return state.paths;
};
const limitFilesSync = (state) => {
    return state.paths.slice(0, state.options.maxFiles);
};
const onlyCountsAsync = (state, error, callback) => {
    report(error, callback, state.counts, state.options.suppressErrors);
    return null;
};
const defaultAsync = (state, error, callback) => {
    report(error, callback, state.paths, state.options.suppressErrors);
    return null;
};
const limitFilesAsync = (state, error, callback) => {
    report(error, callback, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
    return null;
};
const groupsAsync = (state, error, callback) => {
    report(error, callback, state.groups, state.options.suppressErrors);
    return null;
};
function report(error, callback, output, suppressErrors) {
    if (error && !suppressErrors)
        callback(error, output);
    else
        callback(null, output);
}
function build(options, isSynchronous) {
    const { onlyCounts, group, maxFiles } = options;
    if (onlyCounts)
        return isSynchronous
            ? onlyCountsSync
            : onlyCountsAsync;
    else if (group)
        return isSynchronous
            ? groupsSync
            : groupsAsync;
    else if (maxFiles)
        return isSynchronous
            ? limitFilesSync
            : limitFilesAsync;
    else
        return isSynchronous
            ? defaultSync
            : defaultAsync;
}
exports.build = build;

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.26 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/fdir/dist/api/functions/invoke-callback.js