Converting Text Entries into values for machine learning - KNN
It is not recommended to use the method you suggested of converting text to integer values (unless you are using decision trees or XGBoost as the predictive model). If you are usin KNN (and many other models) you should use a technique called one-hot encoding. The reason for this is that (using your example above) Install is 1 and Repair A is 2, but Install isn't necessarily quantitively twice as small as Repair A but you are assigning them 1 and 2 which are quantitively related (2 is twice as big as 1). So your model will interpret it that way.

That is why you need to use One Hot encoding.

I'm not privy to ML in JS but in python you could do:
With pandas:

import pandas as pd

df = pd.DataFrame({
      'A':['a','b','a'],
      'B':['b','a','c']
    })
df
Out[]: 
   A  B
0  a  b
1  b  a
2  a  c

# Get one hot encoding of columns B
one_hot = pd.get_dummies(df['B'])
# Drop column B as it is now encoded
df = df.drop('B',axis = 1)
# Join the encoded df
df = df.join(one_hot)
df  
Out[]: 
   A  a  b  c
0  a  0  1  0
1  b  1  0  0
2  a  0  0  1


Maybe someone else can give you specific code in JS.