This API will add current subscriber to new segment and if option provided yes/no to delete from previous existing segment. it will return true or false
var current_segment = 'CurrentSegmentName'; var change_segment = 'NewSegmentName'; var yes_no = 'yes/no'; var toBeReturn = _pa_changeSegment(current_segment, change_segment, yes_no); console.log(toBeReturn); //return true/false var thenProm = toBeReturn.then(function(value){ console.log(value); });