mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
added declarations for 'ip-subnet-calculator' (#42712)
* added declarations for 'ip-subnet-calculator' * fixed lint for ip-subnet-calculator
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for ip-subnet-calculator 1.1
|
||||
// Project: https://github.com/franksrevenge/IPSubnetCalculator
|
||||
// Definitions by: dahool <https://github.com/dahool>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace IpSubnetCalculator;
|
||||
|
||||
export function calculate(ipStart: string|number, ipEnd: string|number): SubnetResult[];
|
||||
export function calculateSubnetMask(ip: string|number, prefixSize: number): SubnetResult;
|
||||
export function calculateCIDRPrefix(ip: string|number, subnetMask: string|number): SubnetResult;
|
||||
|
||||
export function isIp(ipStr: string): boolean;
|
||||
export function isDecimalIp(ipNum: number): boolean;
|
||||
|
||||
export function toDecimal(ip: string|number): number;
|
||||
export function toString(num: string|number): string;
|
||||
|
||||
export interface SubnetResult {
|
||||
ipLow: number;
|
||||
ipLowStr: string;
|
||||
ipHigh: number;
|
||||
ipHighStr: string;
|
||||
prefixMask: number;
|
||||
prefixMaskStr: string;
|
||||
prefixSize: number;
|
||||
invertedMask: number;
|
||||
invertedMaskStr: string;
|
||||
invertedSize: number;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import * as IpSubnetCalculator from "ip-subnet-calculator";
|
||||
|
||||
IpSubnetCalculator.calculate("", ""); // $ExpectType SubnetResult[]
|
||||
IpSubnetCalculator.calculateSubnetMask("", 1); // $ExpectType SubnetResult
|
||||
IpSubnetCalculator.calculateCIDRPrefix("", 1); // $ExpectType SubnetResult
|
||||
|
||||
IpSubnetCalculator.isIp(""); // $ExpectType boolean
|
||||
IpSubnetCalculator.isDecimalIp(0); // $ExpectType boolean
|
||||
|
||||
IpSubnetCalculator.toDecimal(""); // $ExpectType number
|
||||
IpSubnetCalculator.toString(0); // $ExpectType string
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ip-subnet-calculator-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user