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 {
|
||||
return typeof maybeCapsule.val !== "undefined"
|
||||
return maybeCapsule && typeof maybeCapsule.val !== "undefined"
|
||||
&& typeof maybeCapsule.watch === "function"
|
||||
&& typeof maybeCapsule.toString === "function";
|
||||
}
|
||||
@@ -42,8 +42,8 @@ export default class Capsule<T extends Captable = Captable> implements ICapsule
|
||||
this.isString = typeof val === "string";
|
||||
}
|
||||
|
||||
static new<T extends Captable>(val: T | Capsule<T>): Capsule<T> {
|
||||
if (val instanceof Capsule) {
|
||||
static new<T extends Captable>(val: T | ICapsule<T>): ICapsule<T> {
|
||||
if (isCapsule(val)) {
|
||||
return val;
|
||||
} else {
|
||||
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 {
|
||||
private subscriber: ISubscriber<EventType>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"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",
|
||||
"author": "Daniel Ledda <dan.j.ledda@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
||||
Reference in New Issue
Block a user