#!/usr/bin/perl

use strict;

package API::Utils::Scrub;

return 1;

# In order admin, employees cannot delete an address line
# To work around, they enter an space or multiple spaces
# As a temporary work around until the new order admin is complete, ignore lines with only spaces and do not send to the courier
sub emptyToUndef {
	my $data = shift;
	
	return 0 if (
		not $data
		or ref($data) ne 'HASH'
	);
	
	foreach my $k (keys %{ $data }) {
		
		if (
			not defined($data->{$k})
			or ref($data->{$k})
		) {
			next;
		}
		
		if ($data->{$k} !~ /\S/) {
			$data->{$k} = undef;
		}
		
	}
	
	return 1;
}