UNPKG

pimatic

Version:

A home automation server and framework for the Raspberry PI running on node.js

13 lines (10 loc) 202 B
function count(self, substr) { var count = 0 var pos = self.indexOf(substr) while (pos >= 0) { count += 1 pos = self.indexOf(substr, pos + 1) } return count } module.exports = count