<commit_before>/* jslint node: true */
'use strict';

const _		= require('lodash');

const FTN_ADDRESS_REGEXP = /^([0-9]+:)?([0-9]+)(\/[0-9]+)?(\.[0-9]+)?(@[a-z0-9\-\.]+)?$/i;
const FTN_PATTERN_REGEXP = /^([0-9\*]+:)?([0-9\*]+)(\/[0-9\*]+)?(\.[0-9\*]+)?(@[a-z0-9\-\.\*]+)?$/i;

module.exports = class Address {
	constructor(addr) {
		if(addr) {
			if(_.isObject(addr)) {
				Object.assign(this, addr);
			} else if(_.isString(addr)) {
				const temp = Address.fromString(addr);
				if(temp) {
					Object.assign(this, temp);
				}
			}
		}
	}
<commit_msg>Add valid check methods<commit_after>/* jslint node: true */
'use strict';

const _		= require('lodash');

const FTN_ADDRESS_REGEXP = /^([0-9]+:)?([0-9]+)(\/[0-9]+)?(\.[0-9]+)?(@[a-z0-9\-\.]+)?$/i;
const FTN_PATTERN_REGEXP = /^([0-9\*]+:)?([0-9\*]+)(\/[0-9\*]+)?(\.[0-9\*]+)?(@[a-z0-9\-\.\*]+)?$/i;

module.exports = class Address {
	constructor(addr) {
		if(addr) {
			if(_.isObject(addr)) {
				Object.assign(this, addr);
			} else if(_.isString(addr)) {
				const temp = Address.fromString(addr);
				if(temp) {
					Object.assign(this, temp);
				}
			}
		}
	}

	static isValidAddress(addr) {
		return addr && addr.isValid();
	}

	isValid() {
		//	FTN address is valid if we have at least a net/node
		return _.isNumber(this.net) && _.isNumber(this.node);
	}

{'fraction_non_alphanumeric': 0.283763277693475, 'fraction_numerical': 0.030349013657056147, 'mean_word_length': 3.1608832807570977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4076420', 'n_tokens_mistral': 643, 'n_tokens_neox': 571, 'n_words': 83}