How to use the @casual-simulation/aux-common.isFormula function in @casual-simulation/aux-common

To help you get started, we’ve selected a few @casual-simulation/aux-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github casual-simulation / aux / src / aux-vm / managers / DependencyManager.ts View on Github external
}

        this._botIdMap.set(update.bot.id, update.bot);
        const tags = this._botMap.get(update.bot.id);
        if (tags) {
            // ID never updates so we don't need to include it.
            const botTags = tagsOnBot(update.bot);
            tags.splice(0, tags.length, ...botTags);

            const dependencies = this.getDependencies(update.bot.id);

            for (let tag of update.tags) {
                const bots = this._tagMap.get(tag);
                const val = update.bot.tags[tag];
                if (hasValue(val)) {
                    if (isFormula(val)) {
                        let formulaDependencies = this._dependencies.calculateAuxDependencies(
                            val
                        );

                        if (dependencies[tag]) {
                            this._removeTagDependents(
                                dependencies,
                                tag,
                                update.bot.id
                            );
                        }

                        dependencies[tag] = formulaDependencies;
                        this._addTagDependents(
                            formulaDependencies,
                            tag,
github casual-simulation / aux / src / aux-vm / managers / DependencyManager.ts View on Github external
if (!bot) {
            return {};
        }

        const tags = ['id', ...tagsOnBot(bot)];
        let deps: BotDependencyInfo = {};

        const dependents = tags.map(t => this.getDependents(t));
        const updates =
            reduce(dependents, (first, second) =>
                this._mergeDependents(first, second)
            ) || {};

        for (let tag of tags) {
            const val = bot.tags[tag];
            if (isFormula(val)) {
                let formulaDependencies = this._dependencies.calculateAuxDependencies(
                    val
                );
                deps[tag] = formulaDependencies;
                this._addTagDependents(formulaDependencies, tag, bot);
            }
            let arr = this._tagMap.get(tag);
            if (arr) {
                arr.push(bot.id);
            } else {
                this._tagMap.set(tag, [bot.id]);
            }
        }

        this._dependencyMap.set(bot.id, deps);
        this._botMap.set(bot.id, tags);
github casual-simulation / aux / src / aux-server / aux-web / aux-projector / BotValue / BotValue.ts View on Github external
private _updateValue(force?: boolean) {
        this.isFormula = isFormula(this.value);

        if (!this._focused || force) {
            this._updateVisibleValue();
        }
    }