what is the node.js equivalent of this tsql query : The legacy system used to store passwords in query's output format, 

I have to take that encrypted password and create a node function to get the same result as the below query 

where the password is test and mysalt is the salt used. 

select HASHBYTES('SHA1', convert(VARCHAR, HASHBYTES('SHA1', CONVERT(NVARCHAR(4000), ’test'))) + 'mysalt')
