@glue42/bbg-market-data
Version:
A high-level API that wraps existing Glue42 Bloomberg Bridge Market Data interop methods. The API is based on the jBloomberg open source wrapper.
18 lines (17 loc) • 936 B
JavaScript
import { isEmpty, isNullOrUndefined, nameOf as nameOfFactory, isNumber, isEmptyArray } from "../../utils";
export function validateSubscription(subscription) {
if (isNullOrUndefined(subscription)) {
throw new TypeError("subscription must be a non nullable value");
}
var nameOf = nameOfFactory(subscription);
if (isEmpty(subscription.security)) {
throw new TypeError("subscription property " + nameOf("security") + " is required to be a non empty string.");
}
if (isEmptyArray(subscription.fields)) {
throw new TypeError("subscription property " + nameOf("fields") + " is required to be a non empty array.");
}
var intervalNegative = isNumber(subscription.intervalInSeconds) && subscription.intervalInSeconds < 0;
if (intervalNegative) {
throw new Error("subscription property " + nameOf("intervalInSeconds") + " must be a positive number.");
}
}