express-ext 0.5.15 → 0.5.16
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/lib/resources.js +5 -1
- package/package.json +1 -1
- package/src/resources.ts +8 -2
package/lib/resources.js
CHANGED
|
@@ -22,9 +22,13 @@ var resources = (function () {
|
|
|
22
22
|
exports.resources = resources
|
|
23
23
|
function getView(req, view) {
|
|
24
24
|
var partial = req.query[resources.partial]
|
|
25
|
-
return partial
|
|
25
|
+
return partial === "true" ? resources.pages + "/" + view : view
|
|
26
26
|
}
|
|
27
27
|
exports.getView = getView
|
|
28
|
+
function isPartial(req) {
|
|
29
|
+
return req.query[resources.partial] === "true"
|
|
30
|
+
}
|
|
31
|
+
exports.isPartial = isPartial
|
|
28
32
|
var TypeChecker = (function () {
|
|
29
33
|
function TypeChecker(attributes, allowUndefined) {
|
|
30
34
|
this.attributes = attributes
|
package/package.json
CHANGED
package/src/resources.ts
CHANGED
|
@@ -26,7 +26,10 @@ export class resources {
|
|
|
26
26
|
}
|
|
27
27
|
export function getView(req: Request, view: string): string {
|
|
28
28
|
const partial = req.query[resources.partial]
|
|
29
|
-
return partial
|
|
29
|
+
return partial === "true" ? resources.pages + "/" + view : view
|
|
30
|
+
}
|
|
31
|
+
export function isPartial(req: Request): boolean {
|
|
32
|
+
return req.query[resources.partial] === "true"
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
export interface Validator<T> {
|
|
@@ -35,7 +38,10 @@ export interface Validator<T> {
|
|
|
35
38
|
|
|
36
39
|
// tslint:disable-next-line:max-classes-per-file
|
|
37
40
|
export class TypeChecker {
|
|
38
|
-
constructor(
|
|
41
|
+
constructor(
|
|
42
|
+
public attributes: Attributes,
|
|
43
|
+
public allowUndefined?: boolean,
|
|
44
|
+
) {
|
|
39
45
|
this.check = this.check.bind(this)
|
|
40
46
|
}
|
|
41
47
|
check(req: Request, res: Response, next: NextFunction): void {
|