fix: minor fixes
This commit is contained in:
@@ -13,7 +13,7 @@ export interface ICapsule<T extends Captable = Captable> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isCapsule(maybeCapsule: any): maybeCapsule is ICapsule {
|
export function isCapsule(maybeCapsule: any): maybeCapsule is ICapsule {
|
||||||
return typeof maybeCapsule.val !== "undefined"
|
return maybeCapsule && typeof maybeCapsule.val !== "undefined"
|
||||||
&& typeof maybeCapsule.watch === "function"
|
&& typeof maybeCapsule.watch === "function"
|
||||||
&& typeof maybeCapsule.toString === "function";
|
&& typeof maybeCapsule.toString === "function";
|
||||||
}
|
}
|
||||||
@@ -42,8 +42,8 @@ export default class Capsule<T extends Captable = Captable> implements ICapsule
|
|||||||
this.isString = typeof val === "string";
|
this.isString = typeof val === "string";
|
||||||
}
|
}
|
||||||
|
|
||||||
static new<T extends Captable>(val: T | Capsule<T>): Capsule<T> {
|
static new<T extends Captable>(val: T | ICapsule<T>): ICapsule<T> {
|
||||||
if (val instanceof Capsule) {
|
if (isCapsule(val)) {
|
||||||
return val;
|
return val;
|
||||||
} else {
|
} else {
|
||||||
return new Capsule<T>(val);
|
return new Capsule<T>(val);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import ISubscriber, {LEvent} from "./Subscriber";
|
import { ISubscriber, LEvent } from "./Subscriber";
|
||||||
|
|
||||||
class PublisherSubscription<EventType extends LEvent> implements ISubscription {
|
class PublisherSubscription<EventType extends LEvent> implements ISubscription {
|
||||||
private subscriber: ISubscriber<EventType>;
|
private subscriber: ISubscriber<EventType>;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@djledda/ladder",
|
"name": "@djledda/ladder",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "other libraries provide you with a whole framework - this is just a ladder",
|
"description": "other libraries provide you with a whole framework - this is just a ladder",
|
||||||
"author": "Daniel Ledda <dan.j.ledda@gmail.com>",
|
"author": "Daniel Ledda <dan.j.ledda@gmail.com>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
Reference in New Issue
Block a user