Remove /index imports (swap to bare) (#362)

This commit is contained in:
Jaco Greeff
2019-03-14 08:41:00 +01:00
committed by GitHub
parent a7ef2dcd86
commit de67a88f45
162 changed files with 198 additions and 189 deletions
@@ -4,7 +4,7 @@
import hexToU8a from '@polkadot/util/hex/toU8a';
import { blake2AsHex } from './index';
import { blake2AsHex } from '.';
describe('blake2AsHex', () => {
it('returns a 64-bit value (specified)', () => {
@@ -4,7 +4,7 @@
import hexToU8a from '@polkadot/util/hex/toU8a';
import { blake2AsU8a } from './index';
import { blake2AsU8a } from '.';
describe('blake2AsU8a', () => {
it('returns a 64-bit value by default', () => {
@@ -4,7 +4,7 @@
import hexToU8a from '@polkadot/util/hex/toU8a';
import { blake2bAsHex } from './index';
import { blake2bAsHex } from '.';
describe('blake2bAsHex', () => {
it('creates the correct hash', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import blake2bAsU8a from './asU8a';
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { blake2bAsU8a } from './index';
import { blake2bAsU8a } from '.';
describe('blake2bAsU8a', () => {
it('creates the correct hash (default length)', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { keccakAsHex } from './index';
import { keccakAsHex } from '.';
const value = 'test value';
const result = '2d07364b5c231c56ce63d49430e085ea3033c750688ba532b24029124c26ca5e';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import keccakAsU8a from './asU8a';
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { hexToU8a, stringToU8a } from '@polkadot/util/index';
import { hexToU8a, stringToU8a } from '@polkadot/util';
import { keccakAsU8a } from './index';
import { keccakAsU8a } from '.';
describe('keccakAsU8a', () => {
const input = 'test value';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import BN from 'bn.js';
import { bnToHex, compactAddLength, hexToU8a, isBn, isHex, isNumber, isString, stringToU8a } from '@polkadot/util/index';
import { bnToHex, compactAddLength, hexToU8a, isBn, isHex, isNumber, isString, stringToU8a } from '@polkadot/util';
import blake2AsU8a from '../blake2/asU8a';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { assert, isNull } from '@polkadot/util/index';
import { assert, isNull } from '@polkadot/util';
import DeriveJunction from './DeriveJunction';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { assert, compactAddLength, stringToU8a, u8aConcat } from '@polkadot/util/index';
import { assert, compactAddLength, stringToU8a, u8aConcat } from '@polkadot/util';
import blake2AsU8a from '../blake2/asU8a';
import DeriveJunction from './DeriveJunction';
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { stringToU8a, u8aConcat } from '@polkadot/util/index';
import { stringToU8a, u8aConcat } from '@polkadot/util';
import blake2AsU8a from '../blake2/asU8a';
import DeriveJunction from './DeriveJunction';
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import toEntropy from './toEntropy';
import tests from '../schnorrkel/keypair/testing';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { mnemonicToEntropy } from 'bip39';
import { hexAddPrefix, hexToU8a } from '@polkadot/util/index';
import { hexAddPrefix, hexToU8a } from '@polkadot/util';
export default function toEntropy (mnemonic: string): Uint8Array {
return hexToU8a(
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import mnemonicToMiniSecret from './toMiniSecret';
import tests from '../schnorrkel/keypair/testing';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { pbkdf2Sync } from 'pbkdf2';
import { bufferToU8a, stringToU8a, u8aToBuffer } from '@polkadot/util/index';
import { bufferToU8a, stringToU8a, u8aToBuffer } from '@polkadot/util';
import toEntropy from './toEntropy';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { mnemonicToSeed } from 'bip39';
import { bufferToU8a } from '@polkadot/util/index';
import { bufferToU8a } from '@polkadot/util';
export default function toSecret (mnemonic: string): Uint8Array {
return bufferToU8a(
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { naclDecrypt, naclEncrypt } from './index';
import { naclDecrypt, naclEncrypt } from '.';
describe('naclDecrypt', () => {
it('decrypts a encrypted message', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { naclEncrypt } from './index';
import { naclEncrypt } from '.';
describe('naclEncrypt', () => {
it('encrypts a message', () => {
@@ -4,7 +4,7 @@
import { Keypair } from '../../types';
import { naclKeypairFromRandom } from '../index';
import { naclKeypairFromRandom } from '..';
describe('naclKeypairFromRandom', () => {
let keypair: Keypair;
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { naclKeypairFromSecret } from '../index';
import { naclKeypairFromSecret } from '..';
describe('naclKeypairFromSecret', () => {
const secretKey = new Uint8Array([
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import { naclKeypairFromSeed } from '../index';
import { naclKeypairFromSeed } from '..';
describe('naclKeypairFromSeed', () => {
// NOTE: Aligned with Rust test, b"12345678901234567890123456789012"
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { naclKeypairFromString } from '../index';
import { naclKeypairFromString } from '..';
describe('naclKeypairFromSeed', () => {
it('generates a valid publicKey/secretKey pair', () => {
@@ -4,7 +4,7 @@
import { Keypair } from '../../types';
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import blake2AsU8a from '../../blake2/asU8a';
import fromSeed from './fromSeed';
+2 -2
View File
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import { naclSign, naclKeypairFromSeed } from './index';
import { naclSign, naclKeypairFromSeed } from '.';
describe('naclSign', () => {
let secretKey: Uint8Array;
+1 -1
View File
@@ -5,7 +5,7 @@
import { Keypair } from '../types';
import nacl from 'tweetnacl';
import { assert } from '@polkadot/util/index';
import { assert } from '@polkadot/util';
/**
* @name naclSign
+2 -2
View File
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import { naclVerify, naclKeypairFromSeed } from './index';
import { naclVerify, naclKeypairFromSeed } from '.';
describe('naclSign', () => {
let publicKey: Uint8Array;
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { isHex } from '@polkadot/util/index';
import { isHex } from '@polkadot/util';
import { randomAsHex } from './index';
import { randomAsHex } from '.';
describe('randomAsBuffer', () => {
it('generated results does not match', () => {
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import randomAsU8a from './asU8a';
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { randomAsNumber } from './index';
import { randomAsNumber } from '.';
describe('randomAsNumber', () => {
it('generates subsequent non-matching numbers', () => {
+1 -1
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import BN from 'bn.js';
import { hexToBn } from '@polkadot/util/index';
import { hexToBn } from '@polkadot/util';
import randomAsHex from './asHex';
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { isU8a } from '@polkadot/util/index';
import { isU8a } from '@polkadot/util';
import { randomAsU8a } from './index';
import { randomAsU8a } from '.';
describe('randomAsU8a', () => {
it('generates a Uint8Array', () => {
@@ -4,10 +4,10 @@
import '../test-polyfill';
import { stringToU8a, u8aToHex } from '@polkadot/util/index';
import { stringToU8a, u8aToHex } from '@polkadot/util';
import { mnemonicToMiniSecret } from '../../mnemonic';
import { schnorrkelKeypairFromSeed, schnorrkelWaitReady } from '../index';
import { schnorrkelKeypairFromSeed, schnorrkelWaitReady } from '..';
import tests from './testing';
describe('schnorrkelKeypairFromSeed', () => {
+1 -1
View File
@@ -4,7 +4,7 @@
import { Keypair } from '../types';
import { assert } from '@polkadot/util/index';
import { assert } from '@polkadot/util';
import schnorrkel from '@polkadot/schnorrkel-js';
@@ -4,7 +4,7 @@
import './test-polyfill';
import { stringToU8a } from '@polkadot/util/index';
import { stringToU8a } from '@polkadot/util';
import randomAsU8a from '../random/asU8a';
import pairFromSeed from './keypair/fromSeed';
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import secp256k1 from 'secp256k1';
import { bufferToU8a, u8aToBuffer } from '@polkadot/util/index';
import { bufferToU8a, u8aToBuffer } from '@polkadot/util';
/**
* @name secp256k1Recover
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { sha512AsU8a } from './index';
import { sha512AsU8a } from '.';
describe('sha512AsU8a', () => {
it('creates a sha-512 hash', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { xxhashAsHex } from './index';
import { xxhashAsHex } from '.';
describe('xxhashAsHex', () => {
it('returns a 64-bit value by default', () => {
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { u8aToHex } from '@polkadot/util/index';
import { u8aToHex } from '@polkadot/util';
import xxhashAsU8a from './asU8a';
@@ -2,9 +2,9 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { hexToU8a } from '@polkadot/util/index';
import { hexToU8a } from '@polkadot/util';
import { xxhashAsU8a } from './index';
import { xxhashAsU8a } from '.';
describe('xxhashAsU8a', () => {
it('returns a 64-bit value by default', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { xxhash64AsBn } from './index';
import { xxhash64AsBn } from '.';
describe('xxhash64AsBn', () => {
it('creates the correct BN output', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { xxhash64AsHex } from './index';
import { xxhash64AsHex } from '.';
describe('xxhash64AsHex', () => {
it('creates the correct hex output', () => {
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { hexAddPrefix } from '@polkadot/util/index';
import { hexAddPrefix } from '@polkadot/util';
import xxhash64AsRaw from './asRaw';
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { xxhash64AsRaw } from './index';
import { xxhash64AsRaw } from '.';
describe('xxhash64AsRaw', () => {
it('creates the correct non-prefixed hex output', () => {
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import xxhashjs from 'xxhashjs';
import { isBuffer, isString, u8aToBuffer } from '@polkadot/util/index';
import { isBuffer, isString, u8aToBuffer } from '@polkadot/util';
/**
* @name xxhash64AsValue