PluginProbe
Booking Calendar / 11.8
Booking Calendar v11.8
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
booking / vendors / imask / esm / masked / pipe.js

pipe.js in Booking Calendar 11.8, at vendors/imask/esm/masked/pipe.js

35 lines 900 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import createMask from './factory.js';
2 import IMask from '../core/holder.js';
3 import '../core/utils.js';
4
5 /** Mask pipe source and destination types */
6 const PIPE_TYPE = {
7 MASKED: 'value',
8 UNMASKED: 'unmaskedValue',
9 TYPED: 'typedValue'
10 };
11 /** Creates new pipe function depending on mask type, source and destination options */
12 function createPipe(arg, from, to) {
13 if (from === void 0) {
14 from = PIPE_TYPE.MASKED;
15 }
16 if (to === void 0) {
17 to = PIPE_TYPE.MASKED;
18 }
19 const masked = createMask(arg);
20 return value => masked.runIsolated(m => {
21 m[from] = value;
22 return m[to];
23 });
24 }
25
26 /** Pipes value through mask depending on mask type, source and destination options */
27 function pipe(value, mask, from, to) {
28 return createPipe(mask, from, to)(value);
29 }
30 IMask.PIPE_TYPE = PIPE_TYPE;
31 IMask.createPipe = createPipe;
32 IMask.pipe = pipe;
33
34 export { PIPE_TYPE, createPipe, pipe };
35