static fromOpts()

in statefun-sdk-js/src/core.ts [156:173]


    static fromOpts({name, type, expireAfterCall, expireAfterWrite}: ValueSpecOpts) {
        if (isEmptyOrNull(name)) {
            throw new Error("missing name");
        }
        if (!/^[_a-z]+$/.test(name)) {
            throw new Error(`a name can only contain lower or upper case letters`);
        }
        if (type === undefined || type === null) {
            throw new Error("missing type");
        }
        if (expireAfterCall != null && !Number.isInteger(expireAfterCall)) {
            throw new Error("expireAfterCall is not an integer");
        }
        if (expireAfterWrite != null && !Number.isInteger(expireAfterWrite)) {
            throw new Error("expireAfterWrite is not an integer");
        }
        return new ValueSpec(name, type, expireAfterCall, expireAfterWrite);
    }