avances en plantillas
This commit is contained in:
parent
0f84beacf1
commit
da0530d79b
2062 changed files with 598814 additions and 22 deletions
34
storage/public/dist/libs/imask/esm/masked/pipe.js
vendored
Normal file
34
storage/public/dist/libs/imask/esm/masked/pipe.js
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import createMask from './factory.js';
|
||||
import IMask from '../core/holder.js';
|
||||
import '../core/utils.js';
|
||||
|
||||
/** Mask pipe source and destination types */
|
||||
const PIPE_TYPE = {
|
||||
MASKED: 'value',
|
||||
UNMASKED: 'unmaskedValue',
|
||||
TYPED: 'typedValue'
|
||||
};
|
||||
/** Creates new pipe function depending on mask type, source and destination options */
|
||||
function createPipe(arg, from, to) {
|
||||
if (from === void 0) {
|
||||
from = PIPE_TYPE.MASKED;
|
||||
}
|
||||
if (to === void 0) {
|
||||
to = PIPE_TYPE.MASKED;
|
||||
}
|
||||
const masked = createMask(arg);
|
||||
return value => masked.runIsolated(m => {
|
||||
m[from] = value;
|
||||
return m[to];
|
||||
});
|
||||
}
|
||||
|
||||
/** Pipes value through mask depending on mask type, source and destination options */
|
||||
function pipe(value, mask, from, to) {
|
||||
return createPipe(mask, from, to)(value);
|
||||
}
|
||||
IMask.PIPE_TYPE = PIPE_TYPE;
|
||||
IMask.createPipe = createPipe;
|
||||
IMask.pipe = pipe;
|
||||
|
||||
export { PIPE_TYPE, createPipe, pipe };
|
||||
Loading…
Add table
Add a link
Reference in a new issue