Standard Toolkit
Packages@accelint/predicates

doesNotEndWith

Curried predicate for testing if strings do not end with a specific suffix

Creates a predicate function that determines if a string does not end with a specific suffix.

Usage

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

const isNotBackup = doesNotEndWith('.bak');
const files = ['data.json', 'data.json.bak', 'config.yaml', 'config.yaml.bak'];
const active = files.filter(isNotBackup);
// ['data.json', 'config.yaml']

Reference

function doesNotEndWith(suffix: string): (input: string) => boolean

Parameters

ParameterTypeDescription
suffixstringThe substring to use as the suffix

Returns

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

Examples

Example: Excluding backup files

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

const isNotBackup = doesNotEndWith('.bak');
const files = ['data.json', 'data.json.bak', 'config.yaml', 'config.yaml.bak'];
const active = files.filter(isNotBackup);
// ['data.json', 'config.yaml']

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