mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-17 17:48:06 +00:00
🤖 Merge PR #65900 netmask: constructor accepts string+number by @yoursunny
This commit is contained in:
3
types/netmask/index.d.ts
vendored
3
types/netmask/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/rs/node-netmask
|
||||
// Definitions by: Matt Frantz <https://github.com/mhfrantz>
|
||||
// JanST123 <https://github.com/JanST123>
|
||||
// Junxiao Shi <https://github.com/yoursunny>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
@@ -74,5 +75,5 @@ export class Netmask {
|
||||
* @param net A network - e.g 216.240.32.0/24
|
||||
* @param mask - optional netmask if not provided in `net`
|
||||
*/
|
||||
constructor(net: string, mask?: string);
|
||||
constructor(net: string, mask?: string | number);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import netmask = require('netmask');
|
||||
|
||||
const block = new netmask.Netmask('10.0.0.0/12');
|
||||
let block = new netmask.Netmask('10.0.0.0/12');
|
||||
console.log('base', block.base);
|
||||
|
||||
if (block.contains('10.0.8.10')) {
|
||||
console.log('block contains 10.0.8.10');
|
||||
}
|
||||
|
||||
block = new netmask.Netmask('216.240.32.0', '255.255.255.0');
|
||||
block = new netmask.Netmask('216.240.32.0', 24);
|
||||
|
||||
class CustomizedNetmask extends netmask.Netmask {
|
||||
// Test that we can override `next` to return a CustomizedNetmask (as opposed to netmask.Netmask) object
|
||||
next(count: number = 1): CustomizedNetmask {
|
||||
|
||||
Reference in New Issue
Block a user