Skip to content

Instantly share code, notes, and snippets.

View ShaneMcGowan's full-sized avatar
🤑
I wanted more than life could ever grant me

Shane McGowan ShaneMcGowan

🤑
I wanted more than life could ever grant me
View GitHub Profile
@JonCatmull
JonCatmull / ordinal.pipe.ts
Last active January 12, 2024 16:09
Appends ordinal (st, nd ,rd ,th) to number or turns number into ordinal. Typescript Angular2 Pipe
import { Pipe, PipeTransform } from '@angular/core';
const ordinals: string[] = ['th','st','nd','rd'];
/*
* Append ordinal to number (e.g. "1st" position)
* Usage:
* value | ordinal:keepNumber
* Example:
* {{ 23 | ordinal}}