@foxglove/ros1
Version:
Standalone TypeScript implementation of the ROS 1 (Robot Operating System) protocol with a pluggable transport layer
7 lines (6 loc) • 300 B
text/typescript
// Return the set difference between an array and another array or iterable.
// The results are not sorted in any stable ordering
export function difference<T>(a: T[], b: T[] | IterableIterator<T>): T[] {
const sb = new Set(b);
return Array.from(new Set(a.filter((x) => !sb.has(x))).values());
}