Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
  • Guides

    • Fundamentals

      • Accessing Arrays
      • Basic Array Operations
      • Creating Arrays
    • Intermediate

      • Logic and Filters
      • Making sense of Data
      • Working with 2D data
    • Advanced

      • Data Broadcasting
      • Building a Network
      • Mini Linear Algebra

Logic and Filters: Extracting What You Need

Sometimes, you only want part of your data, such as a slice, a condition, or a masked result. Openmadness is designed to make this intuitive.

Example: Filter Values

Let’s find all values greater than 15:

const data = omArray([10, 20, 30]);
const filtered = data.filter((val) => val > 15);
console.log(filtered.toArray()); 
// ➝ [20, 30]

Example: Logical Masking (Coming Soon)

Logical masking will allow you to create a "mask" from conditions and apply it across your array:

// Pseudo-code for upcoming features
const mask = data.greaterThan(15);
const result = data.mask(mask);
// ➝ [20, 30]

Example: Slicing (Planned)

Want every second item, or a specific row/column? Openmadness will support slicing soon to help you navigate arrays more easily.

Edit this page on GitHub
Last Updated:: 7/7/25, 1:25 PM
Contributors: Dev-Liz
Next
Making sense of Data