Bookmark this: tool.io/parse/feet-and-inches/source-code
Feet and Inches Parser Source Code
Browse the implementation files for Feet and Inches Parser.tool.ts typescript
import { parseFeetAndInches as parsePortableFeetAndInches } from '@tool.io/tools/parse/feet-and-inches';
export const parseFeetAndInches = (input: unknown): number | '' => {
if (typeof input !== 'string' && typeof input !== 'number') return '';
return parsePortableFeetAndInches(String(input)) ?? '';
};
export const Tool: TypeTool = {
name: 'Feet and Inches Parser',
slug: 'parse/feet-and-inches',
intro:
`Parse human-readable feet and inches such as 5'10" into total inches.`,
tool: parseFeetAndInches,
i: [
{
example: `5'10"`,
id: 'value',
label: 'Feet and inches',
placeholder: `5'10"`,
type: 'text',
valueType: { format: 'feet-and-inches', type: 'string' }
}
],
o: [
{
example: '70',
id: 'inches',
label: 'Total inches',
placeholder: 'Total inches',
render: 'textarea',
type: 'number',
valueType: { format: 'length', type: 'number', unit: 'in' }
}
],
alternative: [
{ title: 'Format Feet and Inches', url: '/format/feet-and-inches' },
{ title: 'Convert Length', url: '/convert/length' }
]
};
export default Tool;
Description
Browse the implementation files for Feet and Inches Parser.