Validates if the input data is a valid IP address or if it is within a specified CIDR range.

  • privatebooleanif specified, check if we have an IP address from a private block
  • publicbooleanif specified, check if we have a publicly accessible IP address
  • rangearray of ip | CIDR notationif specified, check if the input IP is within the specified CIDR block
'use strict';
thorin.validate('IP', 'inputString', {
   private: false,
   public: true,
   range: ['']
Do you have a question or is something missing?

You can always create a new issue on GitHub or contact one of the core founders by chat.