npm.io
1.0.2 • Published 6 years ago

@allex/base64

Licence
MIT
Version
1.0.2
Deps
0
Size
9 kB
Vulns
0
Weekly
0

@allex/base64

Lightweight performance optimized base64 library by Allex

Usage

yarn add @allex/base64 -D
import { encode, decode } from '@allex/base64'

describe('base64 encode/decode', () => {
  test('B64.encode() with string', () => {
    expect(encode('allex')).toBe('YWxsZXg=');
    expect(decode('YWxsZXg=')).toBe('allex');
  });
  test('encode() with urlSafe output', () => {
    expect(encode('allex', true)).toBe('YWxsZXg');
    expect(decode('YWxsZXg')).toBe('allex');
  })
});

License

MIT

Keywords