konversi-bilangan
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

konversi-bilangan

Table of contents

Instalasi

  • Menggunakan yarn:
    $ yarn add konversi-bilangan
  • Menggunakan npm:
    $ npm install konversi-bilangan

Cara Penggunaan

import Konversi from 'konversi-bilangan';

// Konversi desimal ke binner
console.log(new Konversi(12).toBinary()); // 1100

Parameter

new Konversi(angka: number | string, type: 'binary' | 'octal' | 'decimal' | 'hexadecimal' = 'decimal')
  • angka - nilai yang ingin dikonversi
  • type - tipe angka, default decimal

Functions

  • .toBinary()
  • .toOctal()
  • .toDecimal()
  • .toHexadecimal()

Examples

  • Binary ke octal
    console.log(new Konversi(1100, 'binary').toOctal()); // Outputs: 14
  • Octal ke binary
    console.log(new Konversi(14, 'octal').toDecimal()); // Outputs: 12
  • Binary ke hexadecimal
    console.log(new Konversi(12, 'decimal').toHexadecimal()); // Outputs: C
  • Hexadesimal ke octal
    console.log(new Konversi('12D', 'hexadecimal').toBinary()); // Outputs: 100101101

Contributing

I would love for you to contribute to andrijunaedi/konversi-bilangan, pull requests are welcome!

License

The scripts and documentation in this project are released under the MIT License

Readme

Keywords

Package Sidebar

Install

npm i konversi-bilangan

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

62.7 kB

Total Files

23

Last publish

Collaborators

  • andrijunaedi