laravel-request 1.2.29 → 1.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ApiRequest.js +14 -0
- package/src/Builder.js +14 -0
package/package.json
CHANGED
package/src/ApiRequest.js
CHANGED
|
@@ -62,6 +62,20 @@ export default class ApiRequest {
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
when(value, callback, defaultCallback = null) {
|
|
66
|
+
let handler = value ? callback : defaultCallback;
|
|
67
|
+
|
|
68
|
+
if (typeof handler === 'function') {
|
|
69
|
+
let result = handler(this, value);
|
|
70
|
+
|
|
71
|
+
if (result instanceof ApiRequest) {
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
|
|
65
79
|
/**
|
|
66
80
|
*
|
|
67
81
|
* @return {null}
|
package/src/Builder.js
CHANGED
|
@@ -79,6 +79,20 @@ export default class Builder {
|
|
|
79
79
|
return this;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
when(value, callback, defaultCallback = null) {
|
|
83
|
+
var handler = value ? callback : defaultCallback;
|
|
84
|
+
|
|
85
|
+
if (typeof handler === 'function') {
|
|
86
|
+
var result = handler(this, value);
|
|
87
|
+
|
|
88
|
+
if (result instanceof Builder) {
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
|
|
82
96
|
toArray() {
|
|
83
97
|
return this.query;
|
|
84
98
|
}
|