Skip to main content

Built and signed on GitHub Actions

Utility functions of Advent of Code.

This package works with Node.js, DenoIt is unknown whether this package works with Cloudflare Workers, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
2 days ago (0.0.2)
function nonEmptyLines
nonEmptyLines(
input: string,
lineSeparator?: string | RegExp,
): string[]

Returns a list of lines of the input that are not empty.

nonEmptyLines("a\nb\n\n\nc\n") // ["a", "b", "c"]

Parameters

input: string

The input string which might contain multiple lines.

optional
lineSeparator: string | RegExp = NEWLINE_REGEX

Line separator. Defaults to the line feed (\n) optionally preceeded by a cariage return (\r).

Return Type

Add Package

deno add jsr:@asantos/aoc

Import symbol

import { nonEmptyLines } from "@asantos/aoc/input";

---- OR ----

Import directly with a jsr specifier

import { nonEmptyLines } from "jsr:@asantos/aoc/input";

Add Package

npx jsr add @asantos/aoc

Import symbol

import { nonEmptyLines } from "@asantos/aoc/input";

Add Package

yarn dlx jsr add @asantos/aoc

Import symbol

import { nonEmptyLines } from "@asantos/aoc/input";

Add Package

pnpm dlx jsr add @asantos/aoc

Import symbol

import { nonEmptyLines } from "@asantos/aoc/input";

Add Package

bunx jsr add @asantos/aoc

Import symbol

import { nonEmptyLines } from "@asantos/aoc/input";