Skip to content

Main content

Convert Electric Charge Source Code

Browse the implementation files for Convert Electric Charge.
@tool.io/tools/convert/electric-charge source ↗
tool.ts typescript
import { convertElectricCharge as convertPortableElectricCharge } from '@tool.io/tools/convert/electric-charge';
import { measureFactorOptions } from '../tool';
import { measureFactors } from './factors';

export const convertElectricCharge = (
	value: number,
	from: string,
	to: string
) => convertPortableElectricCharge(value, from, to) ?? '';

export const Tool: TypeTool = {
	name: 'Convert Electric Charge',
	slug: 'convert/electric-charge',
	tool: convertElectricCharge,
	intro:
		'Convert electric charge between coulombs, ampere-hours, elementary charges, and historical electromagnetic units.',
	i: [
		{
			example: '1',
			label: 'Value',
			placeholder: '1',
			type: 'number'
		},
		{
			example: 'Ah',
			label: 'From',
			placeholder: 'Select the source electric-charge unit',
			options: measureFactorOptions(measureFactors, 'Ah'),
			type: 'select',
			value: 'Ah'
		},
		{
			example: 'C',
			label: 'To',
			placeholder:
				'Select the destination electric-charge unit',
			options: measureFactorOptions(measureFactors, 'C'),
			type: 'select',
			value: 'C'
		}
	],
	o: [
		{
			example: '3600',
			label: 'Electric charge',
			placeholder: 'Converted electric charge',
			render: 'textarea',
			type: 'number'
		}
	],
	swap: {
		inputs: [1, 2],
		name: 'Swap electric-charge units',
		state: false
	},
	alternative: [
		{
			title: 'Convert electric current',
			url: '/convert/electric-current'
		},
		{
			title: 'Convert capacitance',
			url: '/convert/capacitance'
		}
	],
	cite: [
		{
			title: 'SI derived units — BIPM',
			url: 'https://www.bipm.org/en/measurement-units/si-derived-units'
		},
		{
			title: 'Elementary charge — NIST',
			url: 'https://physics.nist.gov/cgi-bin/cuu/Value?e'
		}
	]
};

export default Tool;

Description

Browse the implementation files for Convert Electric Charge.

References

  1. Tool.io on GitHub
  2. Tool.io TypeScript tools library

Similar or alternative tools