How to use @swim/util - 10 common examples

To help you get started, we’ve selected a few @swim/util 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 swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
protected onLintFailure(failure: tslint.RuleFailure): void {
    let tag: Tag;
    if (failure.getEndPosition().getPosition() - failure.getStartPosition().getPosition() > 1) {
      const start = Target.tslinkMark(failure.getStartPosition());
      const end = Target.tslinkMark(failure.getEndPosition(), -1, failure.getFailure());
      tag = Span.from(start, end);
    } else {
      tag =  Target.tslinkMark(failure.getStartPosition(), 0, failure.getFailure());
    }
    const severity = Target.tslintSeverity(failure.getRuleSeverity());
    if (severity.level() >= Severity.ERROR_LEVEL) {
      this.failed = true;
    }

    const sourceFile = (failure as any).sourceFile;
    const input = Unicode.stringInput(sourceFile.text).id(sourceFile.fileName);
    const diagnostic = new Diagnostic(input, tag, severity, failure.getRuleName(), null, null);
    console.log(diagnostic.toString(OutputSettings.styled()));
  }
github swimos / swim / swim-js / swim-core-js / @swim / build / main / Target.ts View on Github external
protected onCompileError(error: ts.Diagnostic): void {
    let message = error.messageText;
    if (typeof message !== "string") {
      message = message.messageText;
    }
    const severity = Target.tsSeverity(error.category);
    if (severity.level() >= Severity.ERROR_LEVEL) {
      this.failed = true;
    }
    if (error.file) {
      let tag: Tag;
      if (error.length! > 1) {
        const start = Target.tsMark(error.start!, error.file);
        const end = Target.tsMark(error.start! + error.length! - 1, error.file, message);
        tag = Span.from(start, end);
      } else {
        tag = Target.tsMark(error.start!, error.file, message);
      }

      const input = Unicode.stringInput(error.file.text).id(error.file.fileName);
      const diagnostic = new Diagnostic(input, tag, severity, "" + error.code, null, null);
      console.log(diagnostic.toString(OutputSettings.styled()));
    } else {
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / member / MemberAnimator.ts View on Github external
MemberAnimator.prototype.update = function (this: MemberAnimator,
                                                                            newValue: T, oldValue: T): void {
    if (!Objects.equal(oldValue, newValue)) {
      this.setDirty(true);
    }
  };
github swimos / swim / swim-system-js / swim-ui-js / @swim / view / main / attribute / AttributeAnimator.ts View on Github external
AttributeAnimator.prototype.update = function (this: AttributeAnimator,
                                                                              newValue: T, oldValue: T): void {
    if (!Objects.equal(oldValue, newValue)) {
      this.willUpdate(newValue, oldValue);
      this._view.setAttribute(this._name, newValue);
      this.didUpdate(newValue, oldValue);
    }
  };
github swimos / swim / swim-system-js / swim-ui-js / @swim / view / main / style / StyleAnimator.ts View on Github external
StyleAnimator.prototype.update = function (this: StyleAnimator,
                                                                          newValue: T, oldValue: T): void {
    if (!Objects.equal(oldValue, newValue)) {
      this.willUpdate(newValue, oldValue);
      const names = this._names;
      if (typeof names === "string") {
        this._view.setStyle(names, newValue, this.priority);
      } else {
        for (let i = 0, n = names.length; i < n; i += 1) {
          this._view.setStyle(names[i], newValue, this.priority);
        }
      }
      this.didUpdate(newValue, oldValue);
    }
  };
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / attribute / AttributeAnimator.ts View on Github external
AttributeAnimator.prototype.update = function (this: AttributeAnimator,
                                                                              newValue: T, oldValue: T): void {
    if (!Objects.equal(oldValue, newValue)) {
      this.willUpdate(newValue, oldValue);
      this._view.setAttribute(this._name, newValue);
      this.didUpdate(newValue, oldValue);
    }
  };
github swimos / swim / swim-js / swim-ui-js / @swim / view / main / style / StyleAnimator.ts View on Github external
StyleAnimator.prototype.update = function (this: StyleAnimator,
                                                                          newValue: T, oldValue: T): void {
    if (!Objects.equal(oldValue, newValue)) {
      this.willUpdate(newValue, oldValue);
      const names = this._names;
      if (typeof names === "string") {
        this._view.setStyle(names, newValue, this.priority);
      } else {
        for (let i = 0, n = names.length; i < n; i += 1) {
          this._view.setStyle(names[i], newValue, this.priority);
        }
      }
      this.didUpdate(newValue, oldValue);
    }
  };
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
private static tsSeverity(category: ts.DiagnosticCategory): Severity {
    switch (category) {
      case ts.DiagnosticCategory.Warning: return Severity.warning();
      case ts.DiagnosticCategory.Error: return Severity.error();
      case ts.DiagnosticCategory.Suggestion: return Severity.note();
      case ts.DiagnosticCategory.Message:
      default: return Severity.info();
    }
  }
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
private static tslintSeverity(severity: tslint.RuleSeverity): Severity {
    switch (severity) {
      case "warning": return Severity.warning();
      case "error": return Severity.error();
      case "off":
      default: return Severity.info();
    }
  }
github swimos / swim / swim-js / swim-core-js / @swim / build / main / Target.ts View on Github external
private static tslintSeverity(severity: tslint.RuleSeverity): Severity {
    switch (severity) {
      case "warning": return Severity.warning();
      case "error": return Severity.error();
      case "off":
      default: return Severity.info();
    }
  }

@swim/util

Interfaces for ordering, equality, hashing, type conversions, functional maps, interpolators, scales, iterators, builders, key-value maps, caches, and assertions

Apache-2.0
Latest version published 7 months ago

Package Health Score

65 / 100
Full package analysis