Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

logoots-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logoots-utils - npm Package Compare versions

Comparing version
0.0.3
to
0.0.4
+13
README.md
**logoots-utils** is a NodeJS module. It implements some functions useful to create and edit data structures provided by the NodeJS module **logoots-structs**.
# Installation
```
npm install logoots-utils
```
# See also
* **logoots-structs**
* **logoots-texteditor-server**
* **logoots-texteditor-client**
* **demo-logoots-texteditor**
+9
-3
{
"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@"
}

@@ -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);
}
};