'extend' API supports both function and object to pass in