source: trip-planner-front/node_modules/tapable/lib/AsyncSeriesBailHook.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5"use strict";
6
7const Hook = require("./Hook");
8const HookCodeFactory = require("./HookCodeFactory");
9
10class AsyncSeriesBailHookCodeFactory extends HookCodeFactory {
11 content({ onError, onResult, resultReturns, onDone }) {
12 return this.callTapsSeries({
13 onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true),
14 onResult: (i, result, next) =>
15 `if(${result} !== undefined) {\n${onResult(
16 result
17 )}\n} else {\n${next()}}\n`,
18 resultReturns,
19 onDone
20 });
21 }
22}
23
24const factory = new AsyncSeriesBailHookCodeFactory();
25
26const COMPILE = function(options) {
27 factory.setup(this, options);
28 return factory.create(options);
29};
30
31function AsyncSeriesBailHook(args = [], name = undefined) {
32 const hook = new Hook(args, name);
33 hook.constructor = AsyncSeriesBailHook;
34 hook.compile = COMPILE;
35 hook._call = undefined;
36 hook.call = undefined;
37 return hook;
38}
39
40AsyncSeriesBailHook.prototype = null;
41
42module.exports = AsyncSeriesBailHook;
Note: See TracBrowser for help on using the repository browser.