fill-range 0.1.1

Fill in a range of numbers or letters: fill("1","5") -> [1,2,3,4,5], fill("a","e") -> [a,b,c,d,e]. A faithful port of the fill-range npm package. Zero dependencies, no_std.
Documentation
# fill-range

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)

[![Crates.io](https://img.shields.io/crates/v/fill-range.svg)](https://crates.io/crates/fill-range)
[![Documentation](https://docs.rs/fill-range/badge.svg)](https://docs.rs/fill-range)
[![CI](https://github.com/trananhtung/fill-range/actions/workflows/ci.yml/badge.svg)](https://github.com/trananhtung/fill-range/actions/workflows/ci.yml)
[![License](https://img.shields.io/crates/l/fill-range.svg)](#license)

**Fill in a range of numbers or letters** — `"1".."5"` → `["1","2","3","4","5"]`,
`"a".."e"` → `["a","b","c","d","e"]`, with an optional step and automatic
zero-padding. A faithful Rust port of the
[`fill-range`](https://www.npmjs.com/package/fill-range) npm package (the range
expander behind `braces`/`micromatch`). Zero dependencies and `#![no_std]`.

```rust
use fill_range::{fill, fill_step};

assert_eq!(fill("1", "5"), ["1", "2", "3", "4", "5"]);
assert_eq!(fill("a", "e"), ["a", "b", "c", "d", "e"]);
assert_eq!(fill("01", "05"), ["01", "02", "03", "04", "05"]); // auto-padded
assert_eq!(fill("5", "1"), ["5", "4", "3", "2", "1"]);        // descending
assert_eq!(fill_step("0", "10", 2), ["0", "2", "4", "6", "8", "10"]);
```

## Why fill-range?

Expanding `1..100` or `a..z` (with steps, padding, and either direction) is the kind
of thing every shell, template engine, and glob library needs. This is the canonical
JS algorithm, ported faithfully so the edge cases — descending ranges, negatives,
zero-padding across the sign — all match.

```toml
[dependencies]
fill-range = "0.1"
```

## API

| Item | Purpose |
| --- | --- |
| `fill(start, end)` | The range as a `Vec<String>` (step 1) |
| `fill_step(start, end, step)` | …with a step (magnitude; direction from the bounds) |

Bounds are passed as `&str` so leading zeros are preserved (`"01"`); they must both
be integers or both single letters. An invalid range returns an empty list.

## Behavior

- Either direction: `fill("5", "1")` counts down.
- Negatives and crossing zero work (`fill("-3", "3")`).
- If any bound (or the step) has a leading zero, every value is zero-padded to the
  longest bound's width — including `0` and negatives (`fill("-03", "03")` →
  `["-03", …, "000", …, "003"]`).
- A step of `0` is treated as `1`; the step's sign is ignored.

To build a **regex** matching a numeric range (the npm package's `toRegex` option),
use the companion [`to-regex-range`](https://crates.io/crates/to-regex-range) crate.

## Contributors ✨

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the [emoji key](https://allcontributors.org/docs/en/emoji-key) for how each contribution is recognized, and open a PR or issue to get involved.

Thanks goes to these wonderful people:

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/trananhtung"><img src="https://avatars.githubusercontent.com/u/30992229?v=4?s=100" width="100px;" alt="Tung Tran"/><br /><sub><b>Tung Tran</b></sub></a><br /><a href="https://github.com/trananhtung/fill-range/commits?author=trananhtung" title="Code">💻</a> <a href="#maintenance-trananhtung" title="Maintenance">🚧</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

## License

Licensed under either of [Apache-2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) at
your option.