updated sys and created publi

This commit is contained in:
Bachir Soussi Chiadmi
2017-12-21 18:09:49 +01:00
parent 2a6e2ff863
commit cefd1c2ad0
9509 changed files with 744901 additions and 32263 deletions
+33
View File
@@ -0,0 +1,33 @@
# find-index
finds an item in an array matching a predicate function,
and returns its index
fast both when `thisArg` is used and also when it isn't: [jsPerf](http://jsperf.com/array-prototype-findindex-shims)
### usage
```bash
npm install find-index
```
```js
findIndex = require('find-index')
findLastIndex = require('find-index/last')
```
findIndex(array, callback[, thisArg])
findLastIndex(array, callback[, thisArg])
Parameters:
array
The array to operate on.
callback
Function to execute on each value in the array, taking three arguments:
element
The current element being processed in the array.
index
The index of the current element being processed in the array.
array
The array findIndex was called upon.
thisArg
Object to use as this when executing callback.
based on [array-findindex](https://www.npmjs.org/package/array-findindex)
+26
View File
@@ -0,0 +1,26 @@
function findIndex(array, predicate, self) {
var len = array.length;
var i;
if (len === 0) return -1;
if (typeof predicate !== 'function') {
throw new TypeError(predicate + ' must be a function');
}
if (self) {
for (i = 0; i < len; i++) {
if (predicate.call(self, array[i], i, array)) {
return i;
}
}
} else {
for (i = 0; i < len; i++) {
if (predicate(array[i], i, array)) {
return i;
}
}
}
return -1;
}
module.exports = findIndex
+26
View File
@@ -0,0 +1,26 @@
function findLastIndex(array, predicate, self) {
var len = array.length;
var i;
if (len === 0) return -1;
if (typeof predicate !== 'function') {
throw new TypeError(predicate + ' must be a function');
}
if (self) {
for (i = len - 1; i >= 0; i--) {
if (predicate.call(self, array[i], i, array)) {
return i;
}
}
} else {
for (i = len - 1; i >= 0; i--) {
if (predicate(array[i], i, array)) {
return i;
}
}
}
return -1;
}
module.exports = findLastIndex
+87
View File
@@ -0,0 +1,87 @@
{
"_args": [
[
{
"raw": "find-index@^0.1.1",
"scope": null,
"escapedName": "find-index",
"name": "find-index",
"rawSpec": "^0.1.1",
"spec": ">=0.1.1 <0.2.0",
"type": "range"
},
"/mnt/Data/bach/Documents/ola/OLA#3DOC/sys/node_modules/glob2base"
]
],
"_from": "find-index@>=0.1.1 <0.2.0",
"_id": "find-index@0.1.1",
"_inCache": true,
"_location": "/find-index",
"_npmUser": {
"name": "jsdf",
"email": "james@jsdf.co"
},
"_npmVersion": "1.4.3",
"_phantomChildren": {},
"_requested": {
"raw": "find-index@^0.1.1",
"scope": null,
"escapedName": "find-index",
"name": "find-index",
"rawSpec": "^0.1.1",
"spec": ">=0.1.1 <0.2.0",
"type": "range"
},
"_requiredBy": [
"/glob2base"
],
"_resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz",
"_shasum": "675d358b2ca3892d795a1ab47232f8b6e2e0dde4",
"_shrinkwrap": null,
"_spec": "find-index@^0.1.1",
"_where": "/mnt/Data/bach/Documents/ola/OLA#3DOC/sys/node_modules/glob2base",
"author": {
"name": "James Friend",
"email": "james@jsdf.co",
"url": "http://jsdf.co/"
},
"bugs": {
"url": "https://github.com/jsdf/find-index/issues"
},
"dependencies": {},
"description": "finds an item in an array matching a predicate function, and returns its index",
"devDependencies": {},
"directories": {},
"dist": {
"shasum": "675d358b2ca3892d795a1ab47232f8b6e2e0dde4",
"tarball": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz"
},
"files": [
"index.js",
"last.js"
],
"homepage": "https://github.com/jsdf/find-index",
"keywords": [
"array",
"findindex"
],
"license": "MIT",
"main": "index.js",
"maintainers": [
{
"name": "jsdf",
"email": "james@jsdf.co"
}
],
"name": "find-index",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/jsdf/find-index.git"
},
"scripts": {
"test": "node test/test"
},
"version": "0.1.1"
}