Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
OmxManager.prototype.create = function create(videos, args) {
// Wrap videos to array if it's a string (sort of overload)
if (is.string(videos)) videos = [videos];
else if (is.not.array(videos)) throw new TypeError('Error: videos: must be a string array.');
else if (!is.all.string(videos)) throw new TypeError('Error: videos: must be a string array.');
// Check for the paths
videos = this._resolveVideosPath(videos);
// If passed an empty array throw an error
if (videos.length === 0) throw new TypeError('Error: videos: array must not be empty.');
// Check for arguments parameter
if (is.not.object(args)) throw new TypeError('Error: args: must be an object.');
// Return the instance
return new OmxInstance(this, this._omxCommand, videos, args, this._dbusController);
};
export const isOptArrayNumber = (item: any) => {
const msg = getMsg(item, 'need to be array of number or null')
return compose(
msg,
some(is.null, is.undefined, is.array, is.all.number)
)
}
export const isOptArrayString = (item: any) => {
export const isReqArrayString = (msg: string) => compose(msg, every(is.not.null, is.not.undefined, is.array, is.all.string))
export const isOptString = (msg: string) => compose(msg, some(is.null, is.undefined, is.string))
export function isArrayOfString(ids: number[] | string[]): ids is string[] {
return is.all.truthy(is.array(ids), is.all.string(ids))
}
export const isReqArrayNumber = (msg: string) => compose(msg, every(is.not.null, is.not.undefined, is.array, is.all.number))
export const isReqArrayString = (msg: string) => compose(msg, every(is.not.null, is.not.undefined, is.array, is.all.string))