Standard Toolkit
Packages@accelint/predicates

doesNotStartWith

Curried predicate for testing if strings do not start with a specific prefix

Creates a predicate function that determines if a string does not start with a specific prefix.

Usage

import { doesNotStartWith } from '@accelint/predicates';

const isNotHidden = doesNotStartWith('.');
const files = ['.git', '.env', 'README.md', '.gitignore', 'src'];
const visible = files.filter(isNotHidden);
// ['README.md', 'src']

Reference

function doesNotStartWith(prefix: string): (input: string) => boolean

Parameters

ParameterTypeDescription
prefixstringThe substring to use as the prefix

Returns

Curried function that accepts a string and returns true if it does not start with the prefix.

Examples

Example: Excluding system files

import { doesNotStartWith } from '@accelint/predicates';

const isNotHidden = doesNotStartWith('.');
const files = ['.git', '.env', 'README.md', '.gitignore', 'src'];
const visible = files.filter(isNotHidden);
// ['README.md', 'src']

Good to know: Comparisons are case-sensitive. Use native String methods like .toLowerCase() before applying this predicate if case-insensitive matching is needed.

On this page