Catalog npm
Back to packageRELEASE DETAILS

0.1.0

npm

6bit-encoder

Encodes 6bit numbers (0..63) to URL safe chars.

Published20 Nov 2017
Direct dependencies1
Transitive dependenciesNot calculated

README

Current package documentation

6bit-encoder build status

Encodes 6bit numbers (0..63) to URL safe chars.

const assert = require('assert')
const { encode, encode5, decode, decode5 } = require('6bit-encoder')

assert.equal(encode(0b001111), 'F')
assert.equal(encode5(0b011111011111011111011111011111), 'VVVVV')
assert.equal(decode('F'), 0b001111)
assert.equal(decode5('VVVVV'), 0b011111011111011111011111011111)

Installation

npm install 6bit-encoder

Table of Contents generated with DocToc

API

SEPARATOR

A URL safe char that is not part of the encoding table and can be used as a separator: '*'

Type: String

SEPARATORS

Remaining URL safe chars that are not part of the encoding table and can be used as a separator: ; , . ~ ( ' ) ! * : @

Type: Array<String>

decode

Decodes one char into a 6 bit number

Parameters

Returns Number a 6 bit number

decode2

Decodes two chars into a 12 bit number

Parameters

  • s String the chars to decode

Returns Number a 12 bit number

decode3

Decodes three chars into an 18 bit number

Parameters

  • s String the chars to decode

Returns Number an 18 bit number

decode4

Decodes four chars into an 24 bit number

Parameters

  • s String the chars to decode

Returns Number a 24 bit number

decode5

Decodes five chars into an 30 bit number

Parameters

  • s String the chars to decode

Returns Number a 30 bit number

encode

Encodes a 6 bit number into a URL safe char

Parameters

Returns String the char

encode2

Encodes a 12 bit number into two URL safe chars

Parameters

Returns String the chars

encode3

Encodes a 18 bit number into three URL safe chars

Parameters

Returns String the chars

encode4

Encodes a 24 bit number into four URL safe chars

Parameters

Returns String the chars

encode5

Encodes a 30 bit number into five URL safe chars

Parameters

Returns String the chars

decodeFor

Get a decode function to decode n chars

Parameters

  • n Number the number of chars to decode

Returns function the matching decoding function

encodeFor

Get an encode function to encode an n * 6 bit number

Parameters

  • n Number number of 6 bits to encode

Returns function the matching encoding function

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
tape
Environment
{
  "local_name": "tape",
  "alias": false,
  "peer_metadata": null
}
~4.8.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "032af94dba075e0345225fb6d541a5a9d773191b",
  "tarball": "https://registry.npmjs.org/6bit-encoder/-/6bit-encoder-0.1.0.tgz",
  "integrity": "sha512-gGyQlgofVqhflU8z3cezBl3LlJ5+8FGa//0HCqFWbRJg9uqfO42njDL150kqDNnmH9kznBQeQ88CPNBDQyn/NA==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIFgkwluKBqs2qwaNULVvf4d/r5FxLGxnOifv2Cf8WOxTAiAotATzElwwjDxBVQQRFg5n0dF6qjavYRuNXLlX6S9msQ=="
    }
  ]
}

Repository

PENDING
thlorenz/6bit-encoder

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:50 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:36f21f7b45e58b1e88be03daeeb796c782808b82e2f20563ea7bd3aba0dbfe00

Other collected versions

0.2.023 NovView all collected versions →