logoots-utils
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "logoots-utils", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Helper providing several function manipulating strings or arrays", | ||
@@ -14,4 +14,10 @@ "main": "utils.js", | ||
], | ||
"author": "Matthieu Nicolas", | ||
"license": "ISC" | ||
"author": { | ||
"name": "Matthieu Nicolas" | ||
}, | ||
"license": "ISC", | ||
"readme": "ERROR: No README data found!", | ||
"_id": "logoots-utils@0.0.3", | ||
"_shasum": "b414ed9c71da1b7a0e98ae555786de3468790c8c", | ||
"_from": "logoots-utils@" | ||
} |
26
utils.js
@@ -75,3 +75,29 @@ module.exports = { | ||
return copy; | ||
}, | ||
occurrences: function (string, subString, allowOverlapping) { | ||
var n; | ||
var pos; | ||
var step; | ||
string += ""; | ||
subString += ""; | ||
if(subString.length<=0) { | ||
return string.length+1; | ||
} | ||
n = 0; | ||
pos = 0; | ||
step = (allowOverlapping) ? (1) : (subString.length); | ||
while(true) { | ||
pos = string.indexOf(subString,pos); | ||
if(pos>=0) { | ||
n++; | ||
pos += step; | ||
} | ||
else { | ||
break; | ||
} | ||
} | ||
return(n); | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
2966
3
98
1
14