@platform/util.value
Advanced tools
Comparing version 0.8.23 to 0.9.0
import { Observable } from 'rxjs'; | ||
export declare function event<E extends { | ||
declare type Event = { | ||
type: string; | ||
payload: unknown; | ||
}>(ob$: Observable<unknown>, type: E['type']): Observable<E>; | ||
export declare function payload<E extends { | ||
type: string; | ||
payload: unknown; | ||
}>(ob$: Observable<unknown>, type: E['type']): Observable<E["payload"]>; | ||
export declare function isEvent(input: any): boolean; | ||
}; | ||
export declare function event<E extends Event>(ob$: Observable<unknown>, type: E['type']): Observable<E>; | ||
export declare function payload<E extends Event>(ob$: Observable<unknown>, type: E['type']): Observable<E["payload"]>; | ||
export declare function isEvent(input: any, type?: string | { | ||
startsWith: string; | ||
}): boolean; | ||
export {}; |
@@ -13,8 +13,27 @@ "use strict"; | ||
exports.payload = payload; | ||
function isEvent(input) { | ||
return (input !== null && | ||
function isEvent(input, type) { | ||
if (!(input !== null && | ||
typeof input === 'object' && | ||
typeof input.type === 'string' && | ||
typeof input.payload === 'object'); | ||
typeof input.payload === 'object')) { | ||
return false; | ||
} | ||
if (type === null) | ||
return false; | ||
if (type !== undefined) { | ||
var event_1 = input; | ||
if (typeof type === 'object') { | ||
if (typeof type.startsWith !== 'string') | ||
return false; | ||
return event_1.type.startsWith(type.startsWith); | ||
} | ||
else { | ||
if (typeof type !== 'string') | ||
return false; | ||
if (event_1.type !== type) | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
exports.isEvent = isEvent; |
{ | ||
"name": "@platform/util.value", | ||
"version": "0.8.23", | ||
"version": "0.9.0", | ||
"description": "Helpers for working with, transforming, and formatting values.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
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
46119
1296