adds if to map js logic