Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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.1 to 0.0.2

2

package.json
{
"name": "logoots-utils",
"version": "0.0.1",
"version": "0.0.2",
"description": "Helper providing several function manipulating strings or arrays",

@@ -5,0 +5,0 @@ "main": "utils.js",

@@ -1,88 +0,76 @@

/**
* Fonction permettant d'insérer à une position 'index' une chaîne de caractères 'string'
*/
var insert = function (s, index, string) {
if (index > 0) {
return s.substring(0, index) + string + s.substring(index, s.length);
}
return string + s;
};
/**
* Fonction permettant de supprimer le caractère à une position 'index'
*/
var del = function (s, begin, end) {
var str = '';
if(begin !== 0) {
str = s.substring(0, begin);
}
return str + s.substring(end + 1, s.length);
};
/**
* Fonction permettant de retirer un élément d'un tableau
*/
var unset = function (arr, elt) {
var index = arr.indexOf(elt);
if(index > -1) {
arr.splice(index, 1);
}
};
/**
* Fonction permettant d'insérer une liste d'éléments dans un tableau
*/
var pushAll = function(arr, elts) {
var i;
for(i=0; i<elts.length; i++) {
arr.push(elts[i]);
}
};
var iterator = function(arr) {
var it = {
index: 0,
items: arr,
first: function() {
this.reset();
return this.next();
},
next: function() {
return this.items[this.index++];
},
hasNext: function() {
return this.index < this.items.length;
},
reset: function() {
this.index = 0;
},
};
return it;
};
var getLast = function (arr) {
return arr[arr.length-1];
};
var copy = function (arr) {
var copy = [];
var i;
for(i=0; i<arr.length; i++) {
if(typeof arr[i] === "number" || typeof arr[i] === "string") {
copy.push(arr[i]);
module.exports = {
Result: {
B1AfterB2: 'B1AfterB2',
B1BeforeB2: 'B1BeforeB2',
B1InsideB2: 'B1InsideB2',
B2InsideB1: 'B2InsideB1',
B1ConcatB2: 'B1ConcatB2',
B2ConcatB1: 'B2ConcatB1'
},
Children: {
LEFT: 0,
RIGHT: 1
},
insert: function (s, index, string) {
if (index > 0) {
return s.substring(0, index) + string + s.substring(index, s.length);
}
else if(typeof arr[i] === "object") {
copy.push(arr[i].copy());
return string + s;
},
del: function (s, begin, end) {
var str = '';
if(begin !== 0) {
str = s.substring(0, begin);
}
return str + s.substring(end + 1, s.length);
},
unset: function (arr, elt) {
var index = arr.indexOf(elt);
if(index > -1) {
arr.splice(index, 1);
}
},
pushAll: function(arr, elts) {
var i;
for(i=0; i<elts.length; i++) {
arr.push(elts[i]);
}
},
iterator: function(arr) {
var it = {
index: 0,
items: arr,
first: function() {
this.reset();
return this.next();
},
next: function() {
return this.items[this.index++];
},
hasNext: function() {
return this.index < this.items.length;
},
reset: function() {
this.index = 0;
},
};
return it;
},
getLast: function (arr) {
return arr[arr.length-1];
},
copy: function (arr) {
var copy = [];
var i;
for(i=0; i<arr.length; i++) {
if(typeof arr[i] === "number" || typeof arr[i] === "string") {
copy.push(arr[i]);
}
else if(typeof arr[i] === "object") {
copy.push(arr[i].copy());
}
}
return copy;
}
return copy;
};
exports.insert = insert;
exports.del = del;
exports.unset = unset;
exports.pushAll = pushAll;
exports.iterator = iterator;
exports.getLast = getLast;
exports.copy = copy;
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc