Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

prevOpen Source→ranges-cropnext

ranges-crop6.2.1

Crop array of ranges when they go beyond the reference string’s length

Downloads per monthChangelogMIT Licenselibera manifesto
  • the top
  • Installation
  • Quick Take
  • Examples
  • API — RCROP()
  • API — VERSION
  • Changelog

Installation

Quick Take

Examples

  • Crop a range that carries a replacement
  • Discard the ranges beyond the string's end
  • Keep an insertion at the string's end
  • Merge and sort the ranges before cropping
  • No ranges to crop

API — rCrop()

The main function rCrop() is imported like this:

It’s a function which takes three input arguments:

Input argumentTypeObligatoryDescription
arrOfRanges
Type: null or ranges — array of zero or more arrays
Obligatory: yes
arrOfRangesnull or ranges — array of zero or more arraysyesProvide an array of ranges to invert. Ranges do not have to be sorted or merged.
strLen
Type: Natural number or zero
Obligatory: yes
strLenNatural number or zeroyesAlgorithm needs to know the length of the reference string to calculate the inverted last slice’s ending index.

Function will return ranges — a null or array of one or more range arrays:

API — version

You can import version:

Changelog

Open Changelog
↑ back to top
prev next

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab