Compare commits

..

2 Commits

Author SHA1 Message Date
qntm 0d4094d746 3.0.1 2020-03-22 16:51:37 +00:00
Bryan C f1c3ae056e
Add typings (#20)
* Fix package-lock.json
base65536-test wasn't a dev dependency for some reason

* Change exports to default exports

* Add typings
2020-03-22 16:49:52 +00:00
5 changed files with 11 additions and 4 deletions

View File

@ -1,2 +1,3 @@
* *
!dist/**/* !dist/**/*
!typings/**/*

3
package-lock.json generated
View File

@ -1926,7 +1926,8 @@
"base65536-test": { "base65536-test": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/base65536-test/-/base65536-test-1.1.2.tgz", "resolved": "https://registry.npmjs.org/base65536-test/-/base65536-test-1.1.2.tgz",
"integrity": "sha1-C+VeHrOXMYXTipCVGFvEAtQqMrM=" "integrity": "sha1-C+VeHrOXMYXTipCVGFvEAtQqMrM=",
"dev": true
}, },
"bcrypt-pbkdf": { "bcrypt-pbkdf": {
"version": "1.0.2", "version": "1.0.2",

View File

@ -1,9 +1,10 @@
{ {
"name": "base65536", "name": "base65536",
"version": "3.0.0", "version": "3.0.1",
"description": "Unicode's answer to Base64", "description": "Unicode's answer to Base64",
"module": "dist/es6/base65536.js", "module": "dist/es6/base65536.js",
"main": "dist/cjs/base65536.js", "main": "dist/cjs/base65536.js",
"types": "typings/index.d.ts",
"browser": "dist/iife/base65536.js", "browser": "dist/iife/base65536.js",
"scripts": { "scripts": {
"jest": "jest", "jest": "jest",

View File

@ -42,7 +42,7 @@ pairStrings.forEach((pairString, r) => {
}) })
}) })
export const encode = uint8Array => { const encode = uint8Array => {
const length = uint8Array.length const length = uint8Array.length
let str = '' let str = ''
@ -80,7 +80,7 @@ export const encode = uint8Array => {
return str return str
} }
export const decode = str => { const decode = str => {
const length = str.length const length = str.length
// This length is a guess. There's a chance we allocate one more byte here // This length is a guess. There's a chance we allocate one more byte here
@ -131,3 +131,5 @@ export const decode = str => {
return new Uint8Array(uint8Array.buffer, 0, numUint8s) return new Uint8Array(uint8Array.buffer, 0, numUint8s)
} }
export { encode, decode }

2
typings/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export declare const encode: (uint8Array: Uint8Array) => string;
export declare const decode: (str: string) => Uint8Array;