Provides binary operations, arithmetic operations, iterators, and allows for custom operations.

Classes

Operations

Methods

(inner) add(value) → {this}

Perform addition operation to an IP instance
Parameters:
NameTypeDescription
valueIPv4 | string | numberThe mask value
Returns:
A pointer to itself
Type: 
this

(inner) and(mask) → {this}

Perform an AND operation to an IP instance
Parameters:
NameTypeDescription
maskIPv4 | string | numberThe mask value
Returns:
A pointer to itself
Type: 
this

(inner) ceil() → {this}

Every byte which is not 0, is set to 255
Returns:
A pointer to itself
Type: 
this

(inner) floor() → {this}

Every byte which is not 255, is set to 0
Returns:
A pointer to itself
Type: 
this

(inner) it(operation) → {this}

Iterate through an IPv4 instance's bytes
Parameters:
NameTypeDescription
operationfunctionAn operation to run, takes 2 arguments, the byte data (0 to 255) and the byte index
Returns:
A pointer to itself
Type: 
this
Example
ip.copy()
  .it((byte, byte_index) => {
    return (byte & mask.u8(byte_index))
   })
  .log();

(inner) or(mask) → {this}

Perform an OR operation to an IP instance
Parameters:
NameTypeDescription
maskIPv4 | string | numberThe mask value
Returns:
A pointer to itself
Type: 
this

(inner) shift_left(bits) → {this}

Shift the IPv4 bits left
Parameters:
NameTypeDescription
bitsNumberThe number of bits to shift the IPv4 instance
Returns:
A pointer to itself
Type: 
this

(inner) shift_right(bits) → {this}

Shift the IPv4 bits right
Parameters:
NameTypeDescription
bitsNumberThe number of bits to shift the IPv4 instance
Returns:
A pointer to itself
Type: 
this

(inner) xor(mask) → {this}

Perform an XOR operation to an IP instance
Parameters:
NameTypeDescription
maskIPv4 | string | numberThe mask value
Returns:
A pointer to itself
Type: 
this