snp-javascript: function