This is an implementation of the English-language Porter stemmer, as described here.
<script src="https://rawgit.com/codekansas/porter-stemmer-js/master/porter.min.js"></script>
<script>
porter.stem('this is a test sentence'); // ['thi', 'is', 'a', 'test', 'sentenc']
porter.stem(['this', 'sentence']); // ['thi', 'sentenc']
porter.stem_word('this'); // 'thi'
</script>