@ribajs/core
Version:
Core module of Riba.js
16 lines (14 loc) • 355 B
text/typescript
import { justDigits, isNumber } from "@ribajs/utils/src/type.js";
/**
* Just get the digits of a string, useful to remove px from css value
* @see http://stackoverflow.com/a/1100653/1465919
*/
export const digitsFormatter = {
name: "digits",
read(str: string) {
if (isNumber(str)) {
return str;
}
return justDigits(str);
},
};