@thisisagile/easy
Advanced tools
Comparing version 1.8.4 to 1.8.5
export declare const toArray: <T>(...items: (T | T[])[]) => T[]; | ||
export declare const array: <T>(...items: (T | T[])[]) => T[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.array = exports.toArray = void 0; | ||
exports.toArray = void 0; | ||
const Is_1 = require("./Is"); | ||
exports.toArray = (...items) => (items.length > 1) ? items : Is_1.isArray(items[0]) ? items[0] : Is_1.isDefined(items[0]) ? [items[0]] : []; | ||
exports.array = (...items) => new Array(...exports.toArray(...items)); | ||
//# sourceMappingURL=Array.js.map |
@@ -16,1 +16,3 @@ import { GetProperty } from './Constructor'; | ||
export declare const list: <T>(...items: (T | T[])[]) => List<T>; | ||
export declare const toList: <T>(...items: (T | T[])[]) => List<T>; | ||
export declare const isList: <T>(l?: unknown) => l is List<T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.list = exports.List = void 0; | ||
exports.isList = exports.toList = exports.list = exports.List = void 0; | ||
const Array_1 = require("./Array"); | ||
@@ -8,2 +8,3 @@ const Constructor_1 = require("./Constructor"); | ||
const Is_1 = require("./Is"); | ||
const IsA_1 = require("./IsA"); | ||
class List extends Array { | ||
@@ -26,2 +27,4 @@ constructor() { | ||
exports.list = (...items) => new List(...Array_1.toArray(...items)); | ||
exports.toList = (...items) => (items.length > 1) ? exports.list(...items) : exports.list(items[0]); | ||
exports.isList = (l) => Is_1.isDefined(l) && Is_1.isArray(l) && IsA_1.isA(l, 'first', 'last', 'asc', 'desc'); | ||
//# sourceMappingURL=List.js.map |
@@ -8,3 +8,3 @@ export declare type Segment = { | ||
host: (key?: string) => Segment; | ||
segment: (key: string) => Segment; | ||
segment: (key?: string) => Segment; | ||
path: (key: string) => Segment; | ||
@@ -11,0 +11,0 @@ query: (key: string) => Segment; |
@@ -13,3 +13,3 @@ "use strict"; | ||
key, | ||
segment: `${key}`, | ||
segment: key, | ||
}), | ||
@@ -39,4 +39,4 @@ path: (key) => ({ | ||
} | ||
get route() { return ['', ...this.segments.map(s => s.segment)].join('/'); } | ||
get complete() { return [this.host, this.resource, ...this.segments].map(s => s.segment).join('/'); } | ||
get route() { return List_1.list(exports.uri.segment(""), ...this.segments).mapDefined(s => s.segment).join('/'); } | ||
get complete() { return List_1.list(this.host, this.resource, ...this.segments).mapDefined(s => s.segment).join('/'); } | ||
toString() { | ||
@@ -43,0 +43,0 @@ var _a; |
{ | ||
"name": "@thisisagile/easy", | ||
"version": "1.8.4", | ||
"version": "1.8.5", | ||
"description": "Straightforward library for building domain-driven microservice architectures", | ||
@@ -5,0 +5,0 @@ "author": "Sander Hoogendoorn", |
@@ -5,3 +5,1 @@ import { isArray, isDefined } from './Is'; | ||
(items.length > 1) ? items as T[] : isArray(items[0]) ? items[0] : isDefined(items[0]) ? [items[0]] : []; | ||
export const array = <T>(...items: (T | T[])[]): Array<T> => new Array<T>(...toArray(...items)); |
import { toArray } from './Array'; | ||
import { GetProperty, ofProperty } from './Constructor'; | ||
import { Json, jsonify } from './Json'; | ||
import { isDefined } from './Is'; | ||
import { isArray, isDefined } from './Is'; | ||
import { isA } from './IsA'; | ||
@@ -37,1 +38,5 @@ export class List<T> extends Array<T> { | ||
export const list = <T>(...items: (T | T[])[]): List<T> => new List<T>(...toArray(...items)); | ||
export const toList = <T>(...items: (T | T[])[]): List<T> => (items.length > 1) ? list<T>(...items) : list<T>(items[0]); | ||
export const isList = <T>(l?: unknown): l is List<T> => isDefined(l) && isArray(l) && isA<List<T>>(l, 'first', 'last', 'asc', 'desc'); |
@@ -13,5 +13,5 @@ import { isNotEmpty } from './Is'; | ||
segment: (key: string): Segment => ({ | ||
segment: (key?: string): Segment => ({ | ||
key, | ||
segment: `${key}`, | ||
segment: key, | ||
}), | ||
@@ -42,5 +42,5 @@ | ||
get route(): string { return ['', ...this.segments.map(s => s.segment)].join('/'); } | ||
get route(): string { return list(uri.segment(""), ...this.segments).mapDefined(s => s.segment).join('/'); } | ||
get complete(): string { return [this.host, this.resource, ...this.segments].map(s => s.segment).join('/'); } | ||
get complete(): string { return list(this.host, this.resource, ...this.segments).mapDefined(s => s.segment).join('/'); } | ||
@@ -47,0 +47,0 @@ set = (segment: Segment, value: unknown): this => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101783
1522