mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 08:58:23 +08:00
Add new packages (#13578)
* Add xstream * Add bigi * Add uuid-js * Add user-home * Add strip-bom * Add strip-ansi * Add slug * Add safe-regex * Add react-recaptcha * Add is-absolute-url * Add is-archive * Add is-compressed * Add is-relative-url * add is-root-path * Add is-root * Add is-text-path * add os-homedir * Add os-tmpdir * Add path-is-absolute * Add pad * Add number-is-nan * Add node-hid * Add is-finite * is-path-incwd * Add indent-string * Add cpy * Add camelcase-keys * Add blacklist * add http-codes * clamp-js * Add checkstyle-formatter * Add currency-formatter * Add multi-typeof * Add intl-messageformat * Add coinstring * Add ecurve * Add bitcoinjs-lib * Add deep-freeze * Add fuxxaldrin * Add react-body-classname * Add react-highlight-words * Update headers * Fix lint errors * remove xstream * Code review comments * Remove clamp-js in favour of https://github.com/DefinitelyTyped/DefinitelyTyped/pull/13527
This commit is contained in:
9
bigi/bigi-tests.ts
Normal file
9
bigi/bigi-tests.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import BigInteger = require('bigi')
|
||||
|
||||
var b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012")
|
||||
var b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811")
|
||||
|
||||
var b3 = b1.multiply(b2)
|
||||
|
||||
console.log(b3.toHex())
|
||||
// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132
|
||||
105
bigi/index.d.ts
vendored
Normal file
105
bigi/index.d.ts
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
// Type definitions for bigi 1.4
|
||||
// Project: https://github.com/cryptocoinjs/bigi#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = bigi;
|
||||
|
||||
declare class bigi {
|
||||
constructor(a: any, b: any, c: any);
|
||||
abs(): any;
|
||||
add(a: bigi): bigi;
|
||||
addTo(a: bigi, r: number): void;
|
||||
am(i: any, x: any, w: any, j: any, c: any, n: any): any;
|
||||
and(a: bigi): bigi;
|
||||
andNot(a: any): any;
|
||||
bitCount(): any;
|
||||
bitLength(): any;
|
||||
bitwiseTo(a: any, op: any, r: any): void;
|
||||
byteLength(): any;
|
||||
byteValue(): any;
|
||||
changeBit(n: any, op: any): any;
|
||||
chunkSize(r: any): any;
|
||||
clamp(): void;
|
||||
clearBit(n: number): bigi;
|
||||
clone(): bigi;
|
||||
compareTo(a: bigi): bigi;
|
||||
copyTo(r: any): void;
|
||||
dAddOffset(n: any, w: any): void;
|
||||
dMultiply(n: number): void;
|
||||
divRemTo(m: any, q: any, r: any): void;
|
||||
divide(a: any): any;
|
||||
divideAndRemainder(a: bigi): bigi;
|
||||
dlShiftTo(n: bigi, r: number): void;
|
||||
drShiftTo(n: bigi, r: number): void;
|
||||
equals(a: bigi): boolean;
|
||||
exp(e: any, z: any): any;
|
||||
flipBit(n: number): bigi;
|
||||
fromInt(x: any): void;
|
||||
fromNumber(a: any, b: any, c: any): void;
|
||||
fromRadix(s: any, b: any): void;
|
||||
fromString(s: any, b: any): void;
|
||||
gcd(a: any): any;
|
||||
getLowestSetBit(): any;
|
||||
intValue(): number;
|
||||
invDigit(): any;
|
||||
isEven(): boolean;
|
||||
isProbablePrime(t: any): boolean;
|
||||
lShiftTo(n: any, r: any): void;
|
||||
max(a: any): any;
|
||||
millerRabin(t: bigi): bigi;
|
||||
min(a: bigi): bigi;
|
||||
mod(a: bigi): bigi;
|
||||
modInt(n: number): bigi;
|
||||
modInverse(m: number): bigi;
|
||||
modPow(e: any, m: any): any;
|
||||
modPowInt(e: any, m: any): any;
|
||||
multiply(a: bigi): bigi;
|
||||
multiplyLowerTo(a: bigi, n: any, r: any): void;
|
||||
multiplyTo(a: bigi, r: any): void;
|
||||
multiplyUpperTo(a: bigi, n: any, r: any): void;
|
||||
negate(): bigi;
|
||||
not(): bigi;
|
||||
or(a: bigi): bigi;
|
||||
pow(e: bigi): bigi;
|
||||
rShiftTo(n: bigi, r: any): void;
|
||||
remainder(a: bigi): bigi;
|
||||
setBit(n: number): bigi;
|
||||
shiftLeft(n: number): bigi;
|
||||
shiftRight(n: number): bigi;
|
||||
shortValue(): bigi;
|
||||
signum(): bigi;
|
||||
square(): bigi;
|
||||
squareTo(r: any): void;
|
||||
subTo(a: any, r: any): void;
|
||||
subtract(a: bigi): bigi;
|
||||
testBit(n: any): any;
|
||||
toBuffer(size: number): any;
|
||||
toByteArray(): any;
|
||||
toByteArrayUnsigned(): any;
|
||||
toDERInteger(): any;
|
||||
toHex(size?: number): string;
|
||||
toRadix(b: number): string;
|
||||
toString(b?: any): string;
|
||||
xor(a: any): any;
|
||||
static fromBuffer(buffer: any): bigi;
|
||||
static fromByteArrayUnsigned(byteArray?: any): number[];
|
||||
static fromDERInteger(byteArray?: any): number;
|
||||
static fromHex(hex: string): bigi;
|
||||
static isBigInteger(obj: any, check_ver: any): obj is bigi;
|
||||
static valueOf(i: any): number;
|
||||
}
|
||||
declare namespace bigi {
|
||||
interface Constants {
|
||||
readonly DB: number;
|
||||
readonly DM: number;
|
||||
readonly DV: number;
|
||||
readonly F1: number;
|
||||
readonly F2: number;
|
||||
readonly FV: number;
|
||||
readonly s: number;
|
||||
readonly t: number;
|
||||
}
|
||||
const ONE: bigi & Constants;
|
||||
const ZERO: bigi & Constants;
|
||||
}
|
||||
20
bigi/tsconfig.json
Normal file
20
bigi/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bigi-tests.ts"
|
||||
]
|
||||
}
|
||||
1
bigi/tslint.json
Normal file
1
bigi/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
63
bitcoinjs-lib/bitcoinjs-lib-tests.ts
Normal file
63
bitcoinjs-lib/bitcoinjs-lib-tests.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import bigi = require('bigi')
|
||||
import bitcoin = require('bitcoinjs-lib');
|
||||
|
||||
declare var it: any;
|
||||
declare var describe: any;
|
||||
declare var assert: any;
|
||||
|
||||
describe('bitcoinjs-lib (basic)', function () {
|
||||
it('can generate a random bitcoin address', function () {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
|
||||
|
||||
// generate random keyPair
|
||||
var keyPair = bitcoin.ECPair.makeRandom({ rng: rng })
|
||||
var address = keyPair.getAddress()
|
||||
|
||||
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64')
|
||||
})
|
||||
|
||||
it('can generate an address from a SHA256 hash', function () {
|
||||
var hash = bitcoin.crypto.sha256('correct horse battery staple')
|
||||
var d = bigi.fromBuffer(hash)
|
||||
|
||||
var keyPair = new bitcoin.ECPair(d)
|
||||
var address = keyPair.getAddress()
|
||||
|
||||
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8')
|
||||
})
|
||||
|
||||
it('can generate a random keypair for alternative networks', function () {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
|
||||
|
||||
var litecoin = bitcoin.networks.litecoin
|
||||
|
||||
var keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng: rng })
|
||||
var wif = keyPair.toWIF()
|
||||
var address = keyPair.getAddress()
|
||||
|
||||
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn')
|
||||
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS')
|
||||
})
|
||||
|
||||
it('can import an address via WIF', function () {
|
||||
var keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct')
|
||||
var address = keyPair.getAddress()
|
||||
|
||||
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31')
|
||||
})
|
||||
|
||||
it('can create a Transaction', function () {
|
||||
var keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy')
|
||||
var tx = new bitcoin.TransactionBuilder()
|
||||
|
||||
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0)
|
||||
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)
|
||||
tx.sign(0, keyPair)
|
||||
|
||||
assert.strictEqual(tx.build().toHex(), '0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000006b483045022100aefbcf847900b01dd3e3debe054d3b6d03d715d50aea8525f5ea3396f168a1fb022013d181d05b15b90111808b22ef4f9ebe701caf2ab48db269691fdf4e9048f4f60121029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000')
|
||||
})
|
||||
})
|
||||
403
bitcoinjs-lib/index.d.ts
vendored
Normal file
403
bitcoinjs-lib/index.d.ts
vendored
Normal file
@@ -0,0 +1,403 @@
|
||||
// Type definitions for bitcoinjs-lib 2.3
|
||||
// Project: https://github.com/bitcoinjs/bitcoinjs-lib#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export class Block {
|
||||
constructor();
|
||||
checkMerkleRoot(): any;
|
||||
checkProofOfWork(): any;
|
||||
getHash(): any;
|
||||
getId(): any;
|
||||
getUTCDate(): any;
|
||||
toBuffer(headersOnly: any): any;
|
||||
toHex(headersOnly: any): any;
|
||||
static calculateMerkleRoot(transactions: any): any;
|
||||
static calculateTarget(bits: any): any;
|
||||
static fromBuffer(buffer: any): any;
|
||||
static fromHex(hex: any): any;
|
||||
}
|
||||
export class ECPair {
|
||||
constructor(d: any, Q?: any, options?: any);
|
||||
getAddress(): string;
|
||||
getNetwork(): Network;
|
||||
getPublicKeyBuffer(): any;
|
||||
sign(hash: any): any;
|
||||
toWIF(): string;
|
||||
verify(hash: any, signature: any): boolean;
|
||||
static fromPublicKeyBuffer(buffer: any, network: Network): ECPair;
|
||||
static fromWIF(string: any, network?: Network): ECPair;
|
||||
static makeRandom(options: any): ECPair;
|
||||
}
|
||||
export class ECSignature {
|
||||
constructor(r: any, s: any, ...args: any[]);
|
||||
toCompact(i: any, compressed: any): any;
|
||||
toDER(): any;
|
||||
toScriptSignature(hashType: any): any;
|
||||
static fromDER(buffer: any): ECSignature;
|
||||
static parseCompact(buffer: any): ECSignature;
|
||||
static parseScriptSignature(buffer: any): ECSignature;
|
||||
}
|
||||
export class HDNode {
|
||||
constructor(keyPair: any, chainCode: any, ...args: any[]);
|
||||
derive(index: any): any;
|
||||
deriveHardened(index: any): any;
|
||||
derivePath(path: any): any;
|
||||
getAddress(): string;
|
||||
getFingerprint(): any;
|
||||
getIdentifier(): any;
|
||||
getNetwork(): Network;
|
||||
getPublicKeyBuffer(): any;
|
||||
isNeutered(): any;
|
||||
neutered(): any;
|
||||
sign(hash: any): any;
|
||||
toBase58(__isPrivate: any): any;
|
||||
toString(__isPrivate: any): any;
|
||||
verify(hash: any, signature: any): any;
|
||||
static HIGHEST_BIT: number;
|
||||
static LENGTH: number;
|
||||
static fromBase58(string: any, networks: Network[]): HDNode;
|
||||
static fromSeedBuffer(seed: any, network: Network, ...args: any[]): HDNode;
|
||||
static fromSeedHex(hex: any, network: Network): HDNode;
|
||||
}
|
||||
export class Transaction {
|
||||
constructor();
|
||||
addInput(hash: any, index: any, sequence: any, scriptSig: any, ...args: any[]): any;
|
||||
addOutput(scriptPubKey: any, value: any, ...args: any[]): any;
|
||||
byteLength(): number;
|
||||
clone(): Transaction;
|
||||
getHash(): any;
|
||||
getId(): any;
|
||||
hashForSignature(inIndex: any, prevOutScript: any, hashType: any, ...args: any[]): any;
|
||||
isCoinbase(): boolean;
|
||||
setInputScript(index: any, scriptSig: any, ...args: any[]): void;
|
||||
toBuffer(buffer?: any, initialOffset?: any): Buffer;
|
||||
toHex(): string;
|
||||
static DEFAULT_SEQUENCE: number;
|
||||
static SIGHASH_ALL: number;
|
||||
static SIGHASH_ANYONECANPAY: number;
|
||||
static SIGHASH_NONE: number;
|
||||
static SIGHASH_SINGLE: number;
|
||||
static fromBuffer(buffer: any, __noStrict: any): Transaction;
|
||||
static fromHex(hex: any): Transaction;
|
||||
static isCoinbaseHash(buffer: any): Transaction;
|
||||
}
|
||||
export class TransactionBuilder {
|
||||
constructor(network?: Network);
|
||||
addInput(txHash: any, vout: any, sequence?: any, prevOutScript?: any): any;
|
||||
addOutput(scriptPubKey: any, value: any): any;
|
||||
build(): Transaction;
|
||||
buildIncomplete(): Transaction;
|
||||
setLockTime(locktime: number): any;
|
||||
setVersion(version: number): void;
|
||||
sign(index: any, keyPair: any, redeemScript?: any, hashType?: any): any;
|
||||
static fromTransaction(transaction: Transaction, network: Network): TransactionBuilder;
|
||||
}
|
||||
|
||||
export interface Network {
|
||||
bitcoin: {
|
||||
private: number;
|
||||
public: number;
|
||||
};
|
||||
dustThreshold: number;
|
||||
messagePrefix: string;
|
||||
pubKeyHash: number;
|
||||
scriptHash: number;
|
||||
wif: number;
|
||||
}
|
||||
|
||||
export const networks: {
|
||||
bitcoin: Network;
|
||||
dogecoin: Network;
|
||||
litecoin: Network;
|
||||
testnet: Network;
|
||||
};
|
||||
|
||||
export const opcodes: {
|
||||
OP_0: number;
|
||||
OP_0NOTEQUAL: number;
|
||||
OP_1: number;
|
||||
OP_10: number;
|
||||
OP_11: number;
|
||||
OP_12: number;
|
||||
OP_13: number;
|
||||
OP_14: number;
|
||||
OP_15: number;
|
||||
OP_16: number;
|
||||
OP_1ADD: number;
|
||||
OP_1NEGATE: number;
|
||||
OP_1SUB: number;
|
||||
OP_2: number;
|
||||
OP_2DIV: number;
|
||||
OP_2DROP: number;
|
||||
OP_2DUP: number;
|
||||
OP_2MUL: number;
|
||||
OP_2OVER: number;
|
||||
OP_2ROT: number;
|
||||
OP_2SWAP: number;
|
||||
OP_3: number;
|
||||
OP_3DUP: number;
|
||||
OP_4: number;
|
||||
OP_5: number;
|
||||
OP_6: number;
|
||||
OP_7: number;
|
||||
OP_8: number;
|
||||
OP_9: number;
|
||||
OP_ABS: number;
|
||||
OP_ADD: number;
|
||||
OP_AND: number;
|
||||
OP_BOOLAND: number;
|
||||
OP_BOOLOR: number;
|
||||
OP_CAT: number;
|
||||
OP_CHECKLOCKTIMEVERIFY: number;
|
||||
OP_CHECKMULTISIG: number;
|
||||
OP_CHECKMULTISIGVERIFY: number;
|
||||
OP_CHECKSIG: number;
|
||||
OP_CHECKSIGVERIFY: number;
|
||||
OP_CODESEPARATOR: number;
|
||||
OP_DEPTH: number;
|
||||
OP_DIV: number;
|
||||
OP_DROP: number;
|
||||
OP_DUP: number;
|
||||
OP_ELSE: number;
|
||||
OP_ENDIF: number;
|
||||
OP_EQUAL: number;
|
||||
OP_EQUALVERIFY: number;
|
||||
OP_FALSE: number;
|
||||
OP_FROMALTSTACK: number;
|
||||
OP_GREATERTHAN: number;
|
||||
OP_GREATERTHANOREQUAL: number;
|
||||
OP_HASH160: number;
|
||||
OP_HASH256: number;
|
||||
OP_IF: number;
|
||||
OP_IFDUP: number;
|
||||
OP_INVALIDOPCODE: number;
|
||||
OP_INVERT: number;
|
||||
OP_LEFT: number;
|
||||
OP_LESSTHAN: number;
|
||||
OP_LESSTHANOREQUAL: number;
|
||||
OP_LSHIFT: number;
|
||||
OP_MAX: number;
|
||||
OP_MIN: number;
|
||||
OP_MOD: number;
|
||||
OP_MUL: number;
|
||||
OP_NEGATE: number;
|
||||
OP_NIP: number;
|
||||
OP_NOP: number;
|
||||
OP_NOP1: number;
|
||||
OP_NOP10: number;
|
||||
OP_NOP2: number;
|
||||
OP_NOP3: number;
|
||||
OP_NOP4: number;
|
||||
OP_NOP5: number;
|
||||
OP_NOP6: number;
|
||||
OP_NOP7: number;
|
||||
OP_NOP8: number;
|
||||
OP_NOP9: number;
|
||||
OP_NOT: number;
|
||||
OP_NOTIF: number;
|
||||
OP_NUMEQUAL: number;
|
||||
OP_NUMEQUALVERIFY: number;
|
||||
OP_NUMNOTEQUAL: number;
|
||||
OP_OR: number;
|
||||
OP_OVER: number;
|
||||
OP_PICK: number;
|
||||
OP_PUBKEY: number;
|
||||
OP_PUBKEYHASH: number;
|
||||
OP_PUSHDATA1: number;
|
||||
OP_PUSHDATA2: number;
|
||||
OP_PUSHDATA4: number;
|
||||
OP_RESERVED: number;
|
||||
OP_RESERVED1: number;
|
||||
OP_RESERVED2: number;
|
||||
OP_RETURN: number;
|
||||
OP_RIGHT: number;
|
||||
OP_RIPEMD160: number;
|
||||
OP_ROLL: number;
|
||||
OP_ROT: number;
|
||||
OP_RSHIFT: number;
|
||||
OP_SHA1: number;
|
||||
OP_SHA256: number;
|
||||
OP_SIZE: number;
|
||||
OP_SUB: number;
|
||||
OP_SUBSTR: number;
|
||||
OP_SWAP: number;
|
||||
OP_TOALTSTACK: number;
|
||||
OP_TRUE: number;
|
||||
OP_TUCK: number;
|
||||
OP_VER: number;
|
||||
OP_VERIF: number;
|
||||
OP_VERIFY: number;
|
||||
OP_VERNOTIF: number;
|
||||
OP_WITHIN: number;
|
||||
OP_XOR: number;
|
||||
};
|
||||
export namespace HDNode {
|
||||
namespace MASTER_SECRET {
|
||||
const BYTES_PER_ELEMENT: number;
|
||||
const byteLength: number;
|
||||
const byteOffset: number;
|
||||
const length: number;
|
||||
const offset: number;
|
||||
function asciiSlice(): any;
|
||||
function asciiWrite(): any;
|
||||
function base64Slice(): any;
|
||||
function base64Write(): any;
|
||||
function compare(target: any, start: any, end: any, thisStart: any, thisEnd: any): any;
|
||||
function copy(): any;
|
||||
function copyWithin(p0: any, p1: any): any;
|
||||
function entries(): any;
|
||||
function equals(b: any): any;
|
||||
function every(p0: any): any;
|
||||
function fill(val: any, start: any, end: any, encoding: any): any;
|
||||
function filter(p0: any): any;
|
||||
function find(p0: any): any;
|
||||
function findIndex(p0: any): any;
|
||||
function forEach(p0: any): any;
|
||||
function hexSlice(): any;
|
||||
function hexWrite(): any;
|
||||
function includes(val: any, byteOffset: any, encoding: any): any;
|
||||
function indexOf(val: any, byteOffset: any, encoding: any): any;
|
||||
function inspect(): any;
|
||||
function join(p0: any): any;
|
||||
function keys(): any;
|
||||
function lastIndexOf(val: any, byteOffset: any, encoding: any): any;
|
||||
function latin1Slice(): any;
|
||||
function latin1Write(): any;
|
||||
function map(p0: any): any;
|
||||
function readDoubleBE(offset: any, noAssert: any): any;
|
||||
function readDoubleLE(offset: any, noAssert: any): any;
|
||||
function readFloatBE(offset: any, noAssert: any): any;
|
||||
function readFloatLE(offset: any, noAssert: any): any;
|
||||
function readInt16BE(offset: any, noAssert: any): any;
|
||||
function readInt16LE(offset: any, noAssert: any): any;
|
||||
function readInt32BE(offset: any, noAssert: any): any;
|
||||
function readInt32LE(offset: any, noAssert: any): any;
|
||||
function readInt8(offset: any, noAssert: any): any;
|
||||
function readIntBE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function readIntLE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function readUInt16BE(offset: any, noAssert: any): any;
|
||||
function readUInt16LE(offset: any, noAssert: any): any;
|
||||
function readUInt32BE(offset: any, noAssert: any): any;
|
||||
function readUInt32LE(offset: any, noAssert: any): any;
|
||||
function readUInt8(offset: any, noAssert: any): any;
|
||||
function readUIntBE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function readUIntLE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function reduce(p0: any): any;
|
||||
function reduceRight(p0: any): any;
|
||||
function reverse(): any;
|
||||
function set(p0: any): any;
|
||||
function slice(start: any, end: any): any;
|
||||
function some(p0: any): any;
|
||||
function sort(p0: any): any;
|
||||
function subarray(p0: any, p1: any): any;
|
||||
function swap16(): any;
|
||||
function swap32(): any;
|
||||
function swap64(): any;
|
||||
function toJSON(): any;
|
||||
function toLocaleString(): any;
|
||||
function toString(...args: any[]): any;
|
||||
function ucs2Slice(): any;
|
||||
function ucs2Write(): any;
|
||||
function undefined(): any;
|
||||
function utf8Slice(): any;
|
||||
function utf8Write(): any;
|
||||
function values(): any;
|
||||
function write(string: any, offset: any, length: any, encoding: any): any;
|
||||
function writeDoubleBE(val: any, offset: any, noAssert: any): any;
|
||||
function writeDoubleLE(val: any, offset: any, noAssert: any): any;
|
||||
function writeFloatBE(val: any, offset: any, noAssert: any): any;
|
||||
function writeFloatLE(val: any, offset: any, noAssert: any): any;
|
||||
function writeInt16BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt16LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt32BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt32LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt8(value: any, offset: any, noAssert: any): any;
|
||||
function writeIntBE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
function writeIntLE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
function writeUInt16BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt16LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt32BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt32LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt8(value: any, offset: any, noAssert: any): any;
|
||||
function writeUIntBE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
function writeUIntLE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
namespace buffer {
|
||||
const byteLength: number;
|
||||
function slice(p0: any, p1: any): any;
|
||||
}
|
||||
namespace parent {
|
||||
const byteLength: number;
|
||||
function slice(p0: any, p1: any): any;
|
||||
}
|
||||
}
|
||||
}
|
||||
export namespace address {
|
||||
function fromBase58Check(address: any): any;
|
||||
function fromOutputScript(scriptPubKey: any, network?: Network): any;
|
||||
function toBase58Check(hash: any, version: any, ...args: any[]): any;
|
||||
function toOutputScript(address: any, network?: Network): any;
|
||||
}
|
||||
export namespace bufferutils {
|
||||
function equal(a: any, b: any): any;
|
||||
function pushDataSize(i: any): any;
|
||||
function readPushDataInt(buffer: any, offset: any): any;
|
||||
function readUInt64LE(buffer: any, offset: any): any;
|
||||
function readVarInt(buffer: any, offset: any): any;
|
||||
function reverse(src: any): any;
|
||||
function varIntBuffer(i: any): any;
|
||||
function varIntSize(i: any): any;
|
||||
function writePushDataInt(buffer: any, number: any, offset: any): any;
|
||||
function writeUInt64LE(buffer: any, value: any, offset: any): void;
|
||||
function writeVarInt(buffer: any, number: any, offset: any): any;
|
||||
}
|
||||
export namespace crypto {
|
||||
function hash160(buffer: any): any;
|
||||
function hash256(buffer: any): any;
|
||||
function ripemd160(buffer: any): any;
|
||||
function sha1(buffer: any): any;
|
||||
function sha256(buffer: any): any;
|
||||
}
|
||||
export namespace message {
|
||||
function magicHash(message: any, network: any): any;
|
||||
function sign(keyPair: any, message: any, network: any): any;
|
||||
function verify(address: any, signature: any, message: any, network: any): any;
|
||||
}
|
||||
export namespace script {
|
||||
function classifyInput(script: any, allowIncomplete: any): any;
|
||||
function classifyOutput(script: any): any;
|
||||
function compile(chunks: any): any;
|
||||
function decompile(buffer: any): any;
|
||||
function fromASM(asm: any): any;
|
||||
function isCanonicalPubKey(buffer: any): any;
|
||||
function isCanonicalSignature(buffer: any): any;
|
||||
function isDefinedHashType(hashType: any): any;
|
||||
function isMultisigInput(script: any, allowIncomplete: any): any;
|
||||
function isMultisigOutput(script: any): any;
|
||||
function isNullDataOutput(script: any): any;
|
||||
function isPubKeyHashInput(script: any): any;
|
||||
function isPubKeyHashOutput(script: any): any;
|
||||
function isPubKeyInput(script: any): any;
|
||||
function isPubKeyOutput(script: any): any;
|
||||
function isScriptHashInput(script: any, allowIncomplete: any): any;
|
||||
function isScriptHashOutput(script: any): any;
|
||||
function isWitnessPubKeyHashOutput(script: any): any;
|
||||
function isWitnessScriptHashOutput(script: any): any;
|
||||
function multisigInput(signatures: any, scriptPubKey: any): any;
|
||||
function multisigOutput(m: any, pubKeys: any, ...args: any[]): any;
|
||||
function nullDataOutput(data: any): any;
|
||||
function pubKeyHashInput(signature: any, pubKey: any, ...args: any[]): any;
|
||||
function pubKeyHashOutput(pubKeyHash: any): any;
|
||||
function pubKeyInput(signature: any): any;
|
||||
function pubKeyOutput(pubKey: any): any;
|
||||
function scriptHashInput(scriptSig: any, scriptPubKey: any): any;
|
||||
function scriptHashOutput(scriptHash: any): any;
|
||||
function toASM(chunks: any): any;
|
||||
function witnessPubKeyHashOutput(pubKeyHash: any): any;
|
||||
function witnessScriptHashInput(scriptSig: any, scriptPubKey: any): any;
|
||||
function witnessScriptHashOutput(scriptHash: any): any;
|
||||
namespace number {
|
||||
function decode(buffer: any, maxLength: any, minimal: any): any;
|
||||
function encode(number: any): any;
|
||||
}
|
||||
}
|
||||
20
bitcoinjs-lib/tsconfig.json
Normal file
20
bitcoinjs-lib/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bitcoinjs-lib-tests.ts"
|
||||
]
|
||||
}
|
||||
1
bitcoinjs-lib/tslint.json
Normal file
1
bitcoinjs-lib/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
13
blacklist/blacklist-tests.ts
Normal file
13
blacklist/blacklist-tests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
var someInput = { a: 1, b: 2, c: 3 }
|
||||
|
||||
import blacklist = require('blacklist')
|
||||
|
||||
blacklist(someInput, 'b', 'c')
|
||||
// => { a: 1 }
|
||||
|
||||
blacklist(someInput, {
|
||||
a: true, // a will not be in the result
|
||||
b: false, // b will be in the result
|
||||
c: 1 > 2 // false, therefore c will be in the result
|
||||
})
|
||||
// => { b: 2, c: 3 }
|
||||
8
blacklist/index.d.ts
vendored
Normal file
8
blacklist/index.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// Type definitions for blacklist 1.1
|
||||
// Project: https://github.com/dcousens/blacklist
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = blacklist;
|
||||
declare function blacklist(src: any, ...args: string[]): any;
|
||||
declare function blacklist(src: any, spec: { [x: string]: boolean }): any;
|
||||
20
blacklist/tsconfig.json
Normal file
20
blacklist/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"blacklist-tests.ts"
|
||||
]
|
||||
}
|
||||
1
blacklist/tslint.json
Normal file
1
blacklist/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
10
camelcase-keys/camelcase-keys-tests.ts
Normal file
10
camelcase-keys/camelcase-keys-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import camelcaseKeys = require('camelcase-keys');
|
||||
|
||||
camelcaseKeys({'foo-bar': true});
|
||||
//=> {fooBar: true}
|
||||
|
||||
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
|
||||
//=> {fooBar: true, nested: {unicornRainbow: true}}
|
||||
|
||||
camelcaseKeys({_: [], 'foo-bar': true});
|
||||
//=> {_: [], fooBar: true}
|
||||
7
camelcase-keys/index.d.ts
vendored
Normal file
7
camelcase-keys/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for camelcase-keys 4.0
|
||||
// Project: https://github.com/sindresorhus/camelcase-keys#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = camelcaseKeys;
|
||||
declare function camelcaseKeys(input: any, options?: { exclude?: string[] | RegExp[], deep?: boolean }): any;
|
||||
20
camelcase-keys/tsconfig.json
Normal file
20
camelcase-keys/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"camelcase-keys-tests.ts"
|
||||
]
|
||||
}
|
||||
1
camelcase-keys/tslint.json
Normal file
1
camelcase-keys/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
checkstyle-formatter/index.d.ts
vendored
Normal file
7
checkstyle-formatter/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for checkstyle-formatter 1.0
|
||||
// Project: https://github.com/jimf/checkstyle-formatter
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = checkstyle_formatter;
|
||||
declare function checkstyle_formatter(results: any): string;
|
||||
19
checkstyle-formatter/tsconfig.json
Normal file
19
checkstyle-formatter/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
1
checkstyle-formatter/tslint.json
Normal file
1
checkstyle-formatter/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
69
coinstring/coinstring-tests.ts
Normal file
69
coinstring/coinstring-tests.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
import cs = require('coinstring')
|
||||
|
||||
|
||||
var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd"
|
||||
var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex')
|
||||
var version = 0x80; //Bitcoin private key
|
||||
|
||||
console.log(cs.encode(privateKeyHexBuf, version))
|
||||
// => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
|
||||
|
||||
var hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8" //hash representing uncompressed
|
||||
var hash160Buf = new Buffer(hash160, 'hex')
|
||||
var version = 0x00; //Bitcoin public address
|
||||
|
||||
console.log(cs.encode(hash160Buf, version));
|
||||
// => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS
|
||||
|
||||
var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd"
|
||||
|
||||
//for compressed, append "01"
|
||||
privateKeyHex += '01'
|
||||
|
||||
var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex')
|
||||
var version = 0x80 //Bitcoin private key
|
||||
|
||||
console.log(cs.encode(privateKeyHexBuf, version))
|
||||
// => KwomKti1X3tYJUUMb1TGSM2mrZk1wb1aHisUNHCQXTZq5auC2qc3
|
||||
|
||||
var hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8" //hash representing uncompressed
|
||||
var hash160Buf = new Buffer(hash160, 'hex')
|
||||
var version = 0x1E //Dogecoin public address
|
||||
|
||||
console.log(cs.encode(hash160Buf, version))
|
||||
// => DAcq9oJpZZAjr56RmF7Y5zmWboZWQ4HAsW
|
||||
|
||||
|
||||
var data = "000000000000000000873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d50800e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35"
|
||||
var buffer = new Buffer(data, 'hex')
|
||||
var versionBuffer = new Buffer('0488ade4', 'hex') //0488ade4 is a consant listed in the aforementioned bip32 wiki.
|
||||
|
||||
console.log(cs.encode(buffer, versionBuffer))
|
||||
// => xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi
|
||||
|
||||
|
||||
var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
|
||||
var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex')
|
||||
var version = 0x80 //Bitcoin private key
|
||||
|
||||
var toBtcWif = cs.createEncoder(version)
|
||||
|
||||
//later in your program
|
||||
console.log(toBtcWif(privateKeyHexBuf))
|
||||
// => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
|
||||
|
||||
|
||||
var wif = "5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD"
|
||||
var version = 0x80 //Bitcoin private key
|
||||
|
||||
var fromBtcWif = cs.createDecoder(version)
|
||||
|
||||
|
||||
var hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8" //hash representing uncompressed
|
||||
var hash160Buf = new Buffer(hash160, 'hex')
|
||||
var version = 0x6F //Bitcoin Testnet Address
|
||||
|
||||
var testnetAddressValidator = cs.createValidator(version)
|
||||
console.log(testnetAddressValidator("mkzgubTA5Ahi6BPSkE6MN9pEafRutznkMe")) // => true
|
||||
13
coinstring/index.d.ts
vendored
Normal file
13
coinstring/index.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// Type definitions for coinstring 2.3
|
||||
// Project: https://github.com/cryptocoinjs/coinstring
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types= "node" />
|
||||
|
||||
export function createDecoder(version: number): (base58str: string, version?: number | Buffer) => Buffer;
|
||||
export function createEncoder(version: number): (payload: Buffer | number[] | Uint8Array, version?: number | Buffer) => string;
|
||||
export function createValidator(version: number): (base58str: string, version?: number | Buffer) => boolean;
|
||||
export function decode(base58str: string, version?: number | Buffer): Buffer;
|
||||
export function encode(payload: Buffer | number[] | Uint8Array, version?: number| Buffer): string;
|
||||
export function isValid(base58str: string, version?: number | Buffer): boolean;
|
||||
20
coinstring/tsconfig.json
Normal file
20
coinstring/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"coinstring-tests.ts"
|
||||
]
|
||||
}
|
||||
1
coinstring/tslint.json
Normal file
1
coinstring/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
10
cpy/cpy-tests.ts
Normal file
10
cpy/cpy-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import cpy = require('cpy');
|
||||
|
||||
cpy(['src/*.png', '!src/goat.png'], 'dist').then(() => {
|
||||
console.log('files copied');
|
||||
});
|
||||
|
||||
|
||||
cpy('foo.js', 'destination', {
|
||||
rename: basename => `prefix-${basename}`
|
||||
});
|
||||
7
cpy/index.d.ts
vendored
Normal file
7
cpy/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for cpy 5.0
|
||||
// Project: https://github.com/sindresorhus/cpy#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = cpy;
|
||||
declare function cpy(src: string | string[], dest: string, opts?: { cwd?: string, parents?: boolean, rename?: (s: string) => string }): Promise<void>;
|
||||
20
cpy/tsconfig.json
Normal file
20
cpy/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cpy-tests.ts"
|
||||
]
|
||||
}
|
||||
1
cpy/tslint.json
Normal file
1
cpy/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
2
currency-formatter/currencies.d.ts
vendored
Normal file
2
currency-formatter/currencies.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { currencies } from "./index";
|
||||
export = currencies;
|
||||
47
currency-formatter/currency-formatter-tests.ts
Normal file
47
currency-formatter/currency-formatter-tests.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import currencyFormatter = require('currency-formatter');
|
||||
|
||||
currencyFormatter.format(1000000, { code: 'USD' });
|
||||
// => '$1,000,000.00'
|
||||
|
||||
currencyFormatter.format(1000000, { code: 'GBP' });
|
||||
// => '£1,000,000.00'
|
||||
|
||||
currencyFormatter.format(1000000, { code: 'EUR' });
|
||||
// => '1 000 000,00 €'
|
||||
|
||||
currencyFormatter.findCurrency('USD');
|
||||
// returns:
|
||||
// {
|
||||
// code: 'USD',
|
||||
// symbol: '$',
|
||||
// thousandsSeparator: ',',
|
||||
// decimalSeparator: '.',
|
||||
// symbolOnLeft: true,
|
||||
// spaceBetweenAmountAndSymbol: false,
|
||||
// decimalDigits: 2
|
||||
// }
|
||||
|
||||
currencyFormatter.format(1000000, {
|
||||
symbol: '@',
|
||||
decimal: '*',
|
||||
thousand: '^',
|
||||
precision: 1,
|
||||
format: '%v %s' // %s is the symbol and %v is the value
|
||||
});
|
||||
|
||||
// => '1^000^000*0 @'
|
||||
|
||||
// Different formatting for positive and negative values
|
||||
currencyFormatter.format(-10, {
|
||||
format: {
|
||||
pos: '%s%v', // %s is the symbol and %v is the value
|
||||
neg: '(%s%v)',
|
||||
zero: '%s%v'
|
||||
}
|
||||
});
|
||||
|
||||
// => ($10)
|
||||
|
||||
|
||||
import currencies = require('currency-formatter/currencies');
|
||||
currencies === currencyFormatter.currencies;
|
||||
30
currency-formatter/index.d.ts
vendored
Normal file
30
currency-formatter/index.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Type definitions for currency-formatter 1.0
|
||||
// Project: https://github.com/smirzaei/currency-formatter#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface Currency {
|
||||
code: string;
|
||||
decimalDigits: number;
|
||||
decimalSeparator: string;
|
||||
spaceBetweenAmountAndSymbol: boolean;
|
||||
symbol: string;
|
||||
symbolOnLeft: boolean;
|
||||
thousandsSeparator: string;
|
||||
}
|
||||
|
||||
export const currencies: Currency[];
|
||||
export const defaultCurrency: Currency;
|
||||
export function findCurrency(currencyCode: string): Currency;
|
||||
export function format(value: number, options: {
|
||||
code?: string,
|
||||
symbol?: string,
|
||||
decimal?: string,
|
||||
thousand?: string,
|
||||
precision?: number,
|
||||
format?: string | {
|
||||
pos: string,
|
||||
neg: string,
|
||||
zero: string
|
||||
}
|
||||
}): string;
|
||||
21
currency-formatter/tsconfig.json
Normal file
21
currency-formatter/tsconfig.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"currencies.d.ts",
|
||||
"currency-formatter-tests.ts"
|
||||
]
|
||||
}
|
||||
1
currency-formatter/tslint.json
Normal file
1
currency-formatter/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
deep-freeze-strict/index.d.ts
vendored
Normal file
7
deep-freeze-strict/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for deep-freeze-strict 1.1
|
||||
// Project: https://github.com/jsdf/deep-freeze
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = deepFreezeStrict;
|
||||
declare function deepFreezeStrict<T>(o: T): T;
|
||||
19
deep-freeze-strict/tsconfig.json
Normal file
19
deep-freeze-strict/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
1
deep-freeze-strict/tslint.json
Normal file
1
deep-freeze-strict/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
55
ecurve/ecurve-tests.ts
Normal file
55
ecurve/ecurve-tests.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import ecurve = require('ecurve');
|
||||
import crypto = require('crypto');
|
||||
|
||||
import BigInteger = require('bigi');
|
||||
import cs = require('coinstring');
|
||||
|
||||
|
||||
var ecparams = ecurve.getCurveByName('secp256k1')
|
||||
console.log(ecparams.n.toString(16))
|
||||
// => fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
|
||||
console.log(ecparams.G.getEncoded().toString('hex')) //getEncoded() returns type 'Buffer' instead of 'BigInteger'
|
||||
// => 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
|
||||
console.log(ecparams.h.toString(16))
|
||||
// => 1
|
||||
|
||||
|
||||
var privateKey = new Buffer("1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd", 'hex')
|
||||
|
||||
var ecparams = ecurve.getCurveByName('secp256k1')
|
||||
var curvePt = ecparams.G.multiply(BigInteger.fromBuffer(privateKey))
|
||||
var x = curvePt.affineX.toBuffer(32)
|
||||
var y = curvePt.affineY.toBuffer(32)
|
||||
|
||||
var publicKey = Buffer.concat([new Buffer([0x04]), x, y])
|
||||
console.log(publicKey.toString('hex'))
|
||||
// => 04d0988bfa799f7d7ef9ab3de97ef481cd0f75d2367ad456607647edde665d6f6fbdd594388756a7beaf73b4822bc22d36e9bda7db82df2b8b623673eefc0b7495
|
||||
|
||||
//alternatively
|
||||
publicKey = curvePt.getEncoded(false) //false forces uncompressed public key
|
||||
console.log(publicKey.toString('hex'))
|
||||
// => 04d0988bfa799f7d7ef9ab3de97ef481cd0f75d2367ad456607647edde665d6f6fbdd594388756a7beaf73b4822bc22d36e9bda7db82df2b8b623673eefc0b7495
|
||||
|
||||
//want compressed?
|
||||
publicKey = curvePt.getEncoded(true) //true forces compressed public key
|
||||
console.log(publicKey.toString('hex'))
|
||||
// => 03d0988bfa799f7d7ef9ab3de97ef481cd0f75d2367ad456607647edde665d6f6f
|
||||
|
||||
var sha = crypto.createHash('sha256').update(publicKey).digest()
|
||||
var pubkeyHash = crypto.createHash('rmd160').update(sha).digest()
|
||||
|
||||
// pubkeyHash of compressed public key
|
||||
console.log(pubkeyHash.toString('hex'))
|
||||
// => a1c2f92a9dacbd2991c3897724a93f338e44bdc1
|
||||
|
||||
// address of compressed public key
|
||||
console.log(cs.encode(pubkeyHash, 0x0)) //<-- 0x0 is for public addresses
|
||||
// => 1FkKMsKNJqWSDvTvETqcCeHcUQQ64kSC6s
|
||||
|
||||
console.log(cs.encode(privateKey, 0x80)) //<--- 0x80 is for private addresses
|
||||
// => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
|
||||
|
||||
console.log(cs.encode(Buffer.concat([privateKey, new Buffer([0])]), 0x80)) // <-- compressed private address
|
||||
// => KwomKti1X3tYJUUMb1TGSM2mrZk1wb1aHisUNHCQXTZq5aqzCxDY
|
||||
41
ecurve/index.d.ts
vendored
Normal file
41
ecurve/index.d.ts
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
// Type definitions for ecurve 1.0
|
||||
// Project: https://github.com/cryptocoinjs/ecurve#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types= "node" />
|
||||
|
||||
import BigInteger = require('bigi');
|
||||
|
||||
export class Curve {
|
||||
p: BigInteger;
|
||||
a: BigInteger;
|
||||
b: BigInteger;
|
||||
G: Point;
|
||||
n: BigInteger;
|
||||
h: BigInteger;
|
||||
constructor(p: BigInteger, a: BigInteger, b: BigInteger, Gx: BigInteger, Gy: BigInteger, n: BigInteger, h: BigInteger);
|
||||
isInfinity(Q: any): boolean;
|
||||
isOnCurve(Q: any): boolean;
|
||||
pointFromX(isOdd: boolean, x: Point): Point;
|
||||
validate(Q: any): boolean;
|
||||
}
|
||||
export class Point {
|
||||
x: BigInteger;
|
||||
y: BigInteger;
|
||||
z: BigInteger;
|
||||
affineX: BigInteger;
|
||||
affineY: BigInteger;
|
||||
constructor(curve: Curve, x: BigInteger, y: BigInteger, z: BigInteger);
|
||||
add(b: Point): Point;
|
||||
equals(other: Point): boolean;
|
||||
getEncoded(compressed?: boolean): Buffer;
|
||||
multiply(k: any): Point;
|
||||
multiplyTwo(j: any, x: any, k: any): Point;
|
||||
negate(): Point;
|
||||
toString(): string;
|
||||
twice(): Point;
|
||||
static decodeFrom(curve: Curve, buffer: Buffer): any;
|
||||
static fromAffine(curve: Curve, x: BigInteger, y: BigInteger): Point;
|
||||
}
|
||||
export function getCurveByName(name: string): Curve;
|
||||
20
ecurve/tsconfig.json
Normal file
20
ecurve/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ecurve-tests.ts"
|
||||
]
|
||||
}
|
||||
1
ecurve/tslint.json
Normal file
1
ecurve/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
8
fuzzaldrin/index.d.ts
vendored
Normal file
8
fuzzaldrin/index.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// Type definitions for fuzzaldrin 2.1
|
||||
// Project: https://github.com/atom/fuzzaldrin
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function filter<T>(candidates: T[], query: string, options?: { key?: string, maxResults?: number }): T[];
|
||||
export function match(string: string, query: string): any;
|
||||
export function score(string: string, query: string): number;
|
||||
19
fuzzaldrin/tsconfig.json
Normal file
19
fuzzaldrin/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
1
fuzzaldrin/tslint.json
Normal file
1
fuzzaldrin/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
67
http-codes/index.d.ts
vendored
Normal file
67
http-codes/index.d.ts
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
// Type definitions for http-codes 1.0
|
||||
// Project: https://github.com/flesler/node-http-codes
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export declare const ACCEPTED: number;
|
||||
export declare const ALREADY_REPORTED: number;
|
||||
export declare const BAD_GATEWAY: number;
|
||||
export declare const BAD_REQUEST: number;
|
||||
export declare const BANDWIDTH_LIMIT_EXCEEDED: number;
|
||||
export declare const CONFLICT: number;
|
||||
export declare const CONTINUE: number;
|
||||
export declare const CREATED: number;
|
||||
export declare const EXPECTATION_FAILED: number;
|
||||
export declare const FAILED_DEPENDENCY: number;
|
||||
export declare const FORBIDDEN: number;
|
||||
export declare const FOUND: number;
|
||||
export declare const GATEWAY_TIMEOUT: number;
|
||||
export declare const GONE: number;
|
||||
export declare const HTTP_VERSION_NOT_SUPPORTED: number;
|
||||
export declare const IM_A_TEAPOT: number;
|
||||
export declare const IM_USED: number;
|
||||
export declare const INSUFFICIENT_STORAGE: number;
|
||||
export declare const INTERNAL_SERVER_ERROR: number;
|
||||
export declare const LENGTH_REQUIRED: number;
|
||||
export declare const LOCKED: number;
|
||||
export declare const LOOP_DETECTED: number;
|
||||
export declare const METHOD_NOT_ALLOWED: number;
|
||||
export declare const MISDIRECTED_REQUEST: number;
|
||||
export declare const MOVED_PERMANENTLY: number;
|
||||
export declare const MULTIPLE_CHOICES: number;
|
||||
export declare const MULTI_STATUS: number;
|
||||
export declare const NETWORK_AUTHENTICATION_REQUIRED: number;
|
||||
export declare const NON_AUTHORITATIVE_INFORMATION: number;
|
||||
export declare const NOT_ACCEPTABLE: number;
|
||||
export declare const NOT_EXTENDED: number;
|
||||
export declare const NOT_FOUND: number;
|
||||
export declare const NOT_IMPLEMENTED: number;
|
||||
export declare const NOT_MODIFIED: number;
|
||||
export declare const NO_CONTENT: number;
|
||||
export declare const OK: number;
|
||||
export declare const PARTIAL_CONTENT: number;
|
||||
export declare const PAYLOAD_TOO_LARGE: number;
|
||||
export declare const PAYMENT_REQUIRED: number;
|
||||
export declare const PERMANENT_REDIRECT: number;
|
||||
export declare const PRECONDITION_FAILED: number;
|
||||
export declare const PRECONDITION_REQUIRED: number;
|
||||
export declare const PROCESSING: number;
|
||||
export declare const PROXY_AUTHENTICATION_REQUIRED: number;
|
||||
export declare const RANGE_NOT_SATISFIABLE: number;
|
||||
export declare const REQUEST_HEADER_FIELDS_TOO_LARGE: number;
|
||||
export declare const REQUEST_TIMEOUT: number;
|
||||
export declare const RESET_CONTENT: number;
|
||||
export declare const SEE_OTHER: number;
|
||||
export declare const SERVICE_UNAVAILABLE: number;
|
||||
export declare const SWITCHING_PROTOCOLS: number;
|
||||
export declare const TEMPORARY_REDIRECT: number;
|
||||
export declare const TOO_MANY_REQUESTS: number;
|
||||
export declare const UNAUTHORIZED: number;
|
||||
export declare const UNAVAILABLE_FOR_LEGAL_REASONS: number;
|
||||
export declare const UNORDERED_COLLECTION: number;
|
||||
export declare const UNPROCESSABLE_ENTITY: number;
|
||||
export declare const UNSUPPORTED_MEDIA_TYPE: number;
|
||||
export declare const UPGRADE_REQUIRED: number;
|
||||
export declare const URI_TOO_LONG: number;
|
||||
export declare const USE_PROXY: number;
|
||||
export declare const VARIANT_ALSO_NEGOTIATES: number;
|
||||
19
http-codes/tsconfig.json
Normal file
19
http-codes/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
1
http-codes/tslint.json
Normal file
1
http-codes/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
9
indent-string/indent-string-tests.ts
Normal file
9
indent-string/indent-string-tests.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import indentString = require('indent-string');
|
||||
|
||||
indentString('Unicorns\nRainbows', 4);
|
||||
//=> ' Unicorns'
|
||||
//=> ' Rainbows'
|
||||
|
||||
indentString('Unicorns\nRainbows', 4, '♥');
|
||||
//=> '♥♥♥♥Unicorns'
|
||||
//=> '♥♥♥♥Rainbows'
|
||||
7
indent-string/index.d.ts
vendored
Normal file
7
indent-string/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for indent-string 3.0
|
||||
// Project: https://github.com/sindresorhus/indent-string#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = indent_string;
|
||||
declare function indent_string(str: string, count: number, indent?: string): string;
|
||||
20
indent-string/tsconfig.json
Normal file
20
indent-string/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"indent-string-tests.ts"
|
||||
]
|
||||
}
|
||||
1
indent-string/tslint.json
Normal file
1
indent-string/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
51
intl-messageformat/index.d.ts
vendored
Normal file
51
intl-messageformat/index.d.ts
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// Type definitions for intl-messageformat 1.3
|
||||
// Project: https://github.com/yahoo/intl-messageformat
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = IntlMessageFormat;
|
||||
export as namespace IntlMessageFormat;
|
||||
|
||||
interface DateFormat {
|
||||
day: string;
|
||||
month: string;
|
||||
weekday: string;
|
||||
year: string;
|
||||
}
|
||||
|
||||
interface TimeFormat {
|
||||
hour: string;
|
||||
minute: string;
|
||||
second: string;
|
||||
timeZoneName: string;
|
||||
}
|
||||
|
||||
declare class IntlMessageFormat {
|
||||
constructor(message: string, locales: string | string[], formats?: any);
|
||||
resolvedOptions(): { locale: string };
|
||||
format(arg: any): string;
|
||||
static default: any;
|
||||
static defaultLocale: string;
|
||||
static formats: {
|
||||
date: {
|
||||
full: DateFormat;
|
||||
long: DateFormat;
|
||||
medium: DateFormat;
|
||||
short: DateFormat;
|
||||
};
|
||||
number: {
|
||||
currency: {
|
||||
style: string;
|
||||
};
|
||||
percent: {
|
||||
style: string;
|
||||
};
|
||||
};
|
||||
time: {
|
||||
full: TimeFormat;
|
||||
long: TimeFormat;
|
||||
medium: TimeFormat;
|
||||
short: TimeFormat;
|
||||
};
|
||||
};
|
||||
}
|
||||
45
intl-messageformat/intl-messageformat-tests.ts
Normal file
45
intl-messageformat/intl-messageformat-tests.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import IntlMessageFormat = require("intl-messageformat");
|
||||
|
||||
|
||||
var msg = new IntlMessageFormat("message", "en-us");
|
||||
|
||||
|
||||
var output = msg.format({name: "Eric"});
|
||||
console.log(output); // => "My name is Eric."
|
||||
|
||||
var MESSAGES = {
|
||||
'en-US': {
|
||||
NUM_PHOTOS: 'You have {numPhotos, plural, ' +
|
||||
'=0 {no photos.}' +
|
||||
'=1 {one photo.}' +
|
||||
'other {# photos.}}'
|
||||
},
|
||||
|
||||
'es-MX': {
|
||||
NUM_PHOTOS: 'Usted {numPhotos, plural, ' +
|
||||
'=0 {no tiene fotos.}' +
|
||||
'=1 {tiene una foto.}' +
|
||||
'other {tiene # fotos.}}'
|
||||
}
|
||||
};
|
||||
|
||||
var enNumPhotos = new IntlMessageFormat(MESSAGES['en-US'].NUM_PHOTOS, 'en-US');
|
||||
output = enNumPhotos.format({numPhotos: 1000});
|
||||
console.log(output); // => "You have 1,000 photos."
|
||||
|
||||
var esNumPhotos = new IntlMessageFormat(MESSAGES['es-MX'].NUM_PHOTOS, 'es-MX');
|
||||
output = esNumPhotos.format({numPhotos: 1000});
|
||||
console.log(output); // => "Usted tiene 1,000 fotos."
|
||||
|
||||
|
||||
var msg = new IntlMessageFormat('The price is: {price, number, USD}', 'en-US', {
|
||||
number: {
|
||||
USD: {
|
||||
style : 'currency',
|
||||
currency: 'USD'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var output = msg.format({price: 100});
|
||||
console.log(output); // => "The price is: $100.00"
|
||||
20
intl-messageformat/tsconfig.json
Normal file
20
intl-messageformat/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"intl-messageformat-tests.ts"
|
||||
]
|
||||
}
|
||||
1
intl-messageformat/tslint.json
Normal file
1
intl-messageformat/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
is-absolute-url/index.d.ts
vendored
Normal file
7
is-absolute-url/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for is-absolute-url 2.1
|
||||
// Project: https://github.com/sindresorhus/is-absolute-url#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = is_absolute_url;
|
||||
declare function is_absolute_url(url: string): boolean;
|
||||
10
is-absolute-url/is-absolute-url-tests.ts
Normal file
10
is-absolute-url/is-absolute-url-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import isAbsoluteUrl = require('is-absolute-url');
|
||||
|
||||
isAbsoluteUrl('http://sindresorhus.com/foo/bar');
|
||||
//=> true
|
||||
|
||||
isAbsoluteUrl('//sindresorhus.com');
|
||||
//=> false
|
||||
|
||||
isAbsoluteUrl('foo/bar');
|
||||
//=> false
|
||||
20
is-absolute-url/tsconfig.json
Normal file
20
is-absolute-url/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-absolute-url-tests.ts"
|
||||
]
|
||||
}
|
||||
1
is-absolute-url/tslint.json
Normal file
1
is-absolute-url/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
is-archive/index.d.ts
vendored
Normal file
7
is-archive/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for is-archive 1.0
|
||||
// Project: https://github.com/sindresorhus/is-archive
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = is_archive;
|
||||
declare function is_archive(filepath: string): boolean;
|
||||
7
is-archive/is-archive-tests.ts
Normal file
7
is-archive/is-archive-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import isArchive = require('is-archive');
|
||||
|
||||
isArchive('src/unicorn.zip');
|
||||
//=> true
|
||||
|
||||
isArchive('src/unicorn.txt');
|
||||
//=> false
|
||||
20
is-archive/tsconfig.json
Normal file
20
is-archive/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-archive-tests.ts"
|
||||
]
|
||||
}
|
||||
1
is-archive/tslint.json
Normal file
1
is-archive/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
is-compressed/index.d.ts
vendored
Normal file
7
is-compressed/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for is-compressed 1.0
|
||||
// Project: https://github.com/sindresorhus/is-compressed
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = is_compressed;
|
||||
declare function is_compressed(filepath: string): boolean;
|
||||
7
is-compressed/is-compressed-tests.ts
Normal file
7
is-compressed/is-compressed-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import isCompressed = require('is-compressed');
|
||||
|
||||
isCompressed('src/unicorn.zip');
|
||||
//=> true
|
||||
|
||||
isCompressed('src/unicorn.txt');
|
||||
//=> false
|
||||
20
is-compressed/tsconfig.json
Normal file
20
is-compressed/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-compressed-tests.ts"
|
||||
]
|
||||
}
|
||||
1
is-compressed/tslint.json
Normal file
1
is-compressed/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
is-finite/index.d.ts
vendored
Normal file
7
is-finite/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for is-finite 1.0
|
||||
// Project: https://github.com/sindresorhus/is-finite#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = is_finite;
|
||||
declare function is_finite(p0: any): boolean;
|
||||
19
is-finite/tsconfig.json
Normal file
19
is-finite/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
1
is-finite/tslint.json
Normal file
1
is-finite/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
is-path-in-cwd/index.d.ts
vendored
Normal file
7
is-path-in-cwd/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for is-path-in-cwd 1.0
|
||||
// Project: https://github.com/sindresorhus/is-path-in-cwd
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = is_path_in_cwd;
|
||||
declare function is_path_in_cwd(str: string): boolean;
|
||||
19
is-path-in-cwd/tsconfig.json
Normal file
19
is-path-in-cwd/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
1
is-path-in-cwd/tslint.json
Normal file
1
is-path-in-cwd/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
is-relative-url/index.d.ts
vendored
Normal file
7
is-relative-url/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for is-relative-url 2.0
|
||||
// Project: https://github.com/sindresorhus/is-relative-url
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = is_relative_url;
|
||||
declare function is_relative_url(url: string): boolean;
|
||||
10
is-relative-url/is-relative-url-tests.ts
Normal file
10
is-relative-url/is-relative-url-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import isRelativeUrl = require('is-relative-url');
|
||||
|
||||
isRelativeUrl('foo/bar');
|
||||
//=> true
|
||||
|
||||
isRelativeUrl('http://sindresorhus.com/foo/bar');
|
||||
//=> false
|
||||
|
||||
isRelativeUrl('//sindresorhus.com');
|
||||
//=> true
|
||||
20
is-relative-url/tsconfig.json
Normal file
20
is-relative-url/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-relative-url-tests.ts"
|
||||
]
|
||||
}
|
||||
1
is-relative-url/tslint.json
Normal file
1
is-relative-url/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
is-root-path/index.d.ts
vendored
Normal file
7
is-root-path/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for is-root-path 1.0
|
||||
// Project: https://github.com/sindresorhus/is-root-path#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = is_root_path;
|
||||
declare function is_root_path(pth: string): boolean;
|
||||
7
is-root-path/is-root-path-tests.ts
Normal file
7
is-root-path/is-root-path-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import isRootPath = require('is-root-path');
|
||||
|
||||
isRootPath('/');
|
||||
//=> true
|
||||
|
||||
isRootPath('/Users');
|
||||
//=> false
|
||||
20
is-root-path/tsconfig.json
Normal file
20
is-root-path/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-root-path-tests.ts"
|
||||
]
|
||||
}
|
||||
1
is-root-path/tslint.json
Normal file
1
is-root-path/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
is-root/index.d.ts
vendored
Normal file
7
is-root/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for is-root 1.0
|
||||
// Project: https://github.com/sindresorhus/is-root
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = is_root;
|
||||
declare function is_root(): boolean;
|
||||
5
is-root/is-root-tests.ts
Normal file
5
is-root/is-root-tests.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// index.js
|
||||
import isRoot = require('is-root');
|
||||
|
||||
isRoot();
|
||||
//=> true
|
||||
20
is-root/tsconfig.json
Normal file
20
is-root/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-root-tests.ts"
|
||||
]
|
||||
}
|
||||
1
is-root/tslint.json
Normal file
1
is-root/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
is-text-path/index.d.ts
vendored
Normal file
7
is-text-path/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for is-text-path 1.0
|
||||
// Project: https://github.com/sindresorhus/is-text-path
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = is_text_path;
|
||||
declare function is_text_path(filepath: string): boolean;
|
||||
7
is-text-path/is-text-path-tests.ts
Normal file
7
is-text-path/is-text-path-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import isTextPath = require('is-text-path');
|
||||
|
||||
isTextPath('src/unicorn.txt');
|
||||
//=> true
|
||||
|
||||
isTextPath('src/unicorn.png');
|
||||
//=> false
|
||||
20
is-text-path/tsconfig.json
Normal file
20
is-text-path/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"is-text-path-tests.ts"
|
||||
]
|
||||
}
|
||||
1
is-text-path/tslint.json
Normal file
1
is-text-path/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
multi-typeof/index.d.ts
vendored
Normal file
7
multi-typeof/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for multi-typeof 1.0
|
||||
// Project: https://github.com/gillstrom/multi-typeof#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = multi_typeof;
|
||||
declare function multi_typeof(input: any, types: string[]): boolean;
|
||||
19
multi-typeof/tsconfig.json
Normal file
19
multi-typeof/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
1
multi-typeof/tslint.json
Normal file
1
multi-typeof/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
31
node-hid/index.d.ts
vendored
Normal file
31
node-hid/index.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Type definitions for node-hid 0.5
|
||||
// Project: https://github.com/node-hid/node-hid#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Device {
|
||||
vendorId: number;
|
||||
productId: number;
|
||||
path: string;
|
||||
serialNumber: string;
|
||||
manufacturer: string;
|
||||
product: string;
|
||||
release: number;
|
||||
interface: number;
|
||||
}
|
||||
|
||||
export class HID {
|
||||
constructor(path: string);
|
||||
constructor(vid: number, pid: number);
|
||||
close(): void;
|
||||
pause(): void;
|
||||
read(callback: (value: any, err: any) => void): any;
|
||||
readSync(): number[];
|
||||
readTimeout(time_out: number): number[];
|
||||
sendFeatureReport(data: number[]): void;
|
||||
getFeatureReport(report_id: number, report_length: number): number[];
|
||||
resume(): void;
|
||||
on(event: string, handler: (value: any) => void): void;
|
||||
write(values: number[]): void;
|
||||
}
|
||||
export function devices(): Device[];
|
||||
13
node-hid/node-hid-tests.ts
Normal file
13
node-hid/node-hid-tests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import HID = require('node-hid');
|
||||
|
||||
var devices = HID.devices()
|
||||
|
||||
|
||||
var device = new HID.HID("path");
|
||||
|
||||
var device = new HID.HID(12, 22);
|
||||
|
||||
device.on("data", function (data) { });
|
||||
device.on("error", function (err) { });
|
||||
|
||||
device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]);
|
||||
20
node-hid/tsconfig.json
Normal file
20
node-hid/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-hid-tests.ts"
|
||||
]
|
||||
}
|
||||
1
node-hid/tslint.json
Normal file
1
node-hid/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
number-is-nan/index.d.ts
vendored
Normal file
7
number-is-nan/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for number-is-nan 1.0
|
||||
// Project: https://github.com/sindresorhus/number-is-nan#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = number_is_nan;
|
||||
declare function number_is_nan(p0: number): boolean;
|
||||
19
number-is-nan/tsconfig.json
Normal file
19
number-is-nan/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
1
number-is-nan/tslint.json
Normal file
1
number-is-nan/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
7
os-homedir/index.d.ts
vendored
Normal file
7
os-homedir/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Type definitions for os-homedir 1.0
|
||||
// Project: https://github.com/sindresorhus/os-homedir#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = os_homedir;
|
||||
declare function os_homedir(): string;
|
||||
19
os-homedir/tsconfig.json
Normal file
19
os-homedir/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
1
os-homedir/tslint.json
Normal file
1
os-homedir/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user