-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (30 loc) · 850 Bytes
/
Copy pathindex.js
File metadata and controls
37 lines (30 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"use strict"
const UPI = require("./upi"),
UPIP = require("./upi-p");
function factoryP(vpat, name, isDyanmic, ammount) {
return new UPIP(function (rslv, rjct) {
let upi = new UPI(vpat, name, isDyanmic, ammount)
if (!!upi) {
rslv(upi)
} else {
rjct(Error("UPI object not initialized"))
}
})
}
function factory(vpat, name, isDyanmic, ammount) {
return new UPI(vpat, name, isDyanmic, ammount)
}
module.exports = {
Static: function (vpat, name, ammount) {
return factory(vpat, name, false, ammount)
},
Dynamic: function (vpat, name, ammount) {
return factory(vpat, name, true, ammount)
},
StaticP: function (vpat, name, ammount) {
return factoryP(vpat, name, false, ammount)
},
DynamicP: function (vpat, name, ammount) {
return factoryP(vpat, name, true, ammount)
},
}