Code Explainers

Code explainers tagged #cycle-detection

javascript
class Sheet {
  constructor() {
    this.cells = new Map();
    this.computing = new Set();

Building a reactive spreadsheet engine

reactivity dependency-tracking graph-traversal
Advanced 9 steps
rust
use std::collections::HashMap;
 
#[derive(Clone, Copy, PartialEq)]
enum Color {

Detecting cycles with three-color DFS in Rust

graph-algorithms cycle-detection depth-first-search
Intermediate 9 steps
typescript
type Masker = (value: string) => string;
 
const maskEmail: Masker = (value) => {
  const [local, domain] = value.split("@");

Recursively masking sensitive data for logs

recursion regex data-masking
Intermediate 9 steps
typescript
type CloneInput = Record<string, unknown> | unknown[] | Map<unknown, unknown> | Set<unknown>;
 
export function deepClone<T>(value: T): T {
  if (typeof structuredClone === "function") {

Building a deepClone with cycle safety

recursion deep-copy cycle-detection
Intermediate 8 steps