Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1 @@
node_modules/

View File

@@ -0,0 +1,22 @@
Copyright (c) 2013 Dominic Tarr
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,24 @@
# indexes-of
like Array/String#indexOf but return all the indexes in an array.
``` js
var indexesOf = require('indexes-of')
var twosIndexes = indexesOf([1, 2, 3, 4, 5, 4, 3, 2, 1], 2)
console.log(twosIndexes)
// [1, 7]
```
# Haiku
* A 5 line module.
* But the tests are 40 lines.
* npm publish.
## License
MIT

View File

@@ -0,0 +1,6 @@
module.exports = function (ary, item) {
var i = -1, indexes = []
while((i = ary.indexOf(item, i + 1)) !== -1)
indexes.push(i)
return indexes
}

View File

@@ -0,0 +1,53 @@
{
"_args": [
[
"indexes-of@1.0.1",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "indexes-of@1.0.1",
"_id": "indexes-of@1.0.1",
"_inBundle": false,
"_integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=",
"_location": "/css-loader/indexes-of",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "indexes-of@1.0.1",
"name": "indexes-of",
"escapedName": "indexes-of",
"rawSpec": "1.0.1",
"saveSpec": null,
"fetchSpec": "1.0.1"
},
"_requiredBy": [
"/css-loader/postcss-selector-parser"
],
"_resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz",
"_spec": "1.0.1",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "Dominic Tarr",
"email": "dominic.tarr@gmail.com",
"url": "dominictarr.com"
},
"bugs": {
"url": "https://github.com/dominictarr/indexes-of/issues"
},
"description": "line String/Array#indexOf but return all the indexes in an array",
"devDependencies": {
"tape": "~2.1.0"
},
"homepage": "https://github.com/dominictarr/indexes-of",
"license": "MIT",
"name": "indexes-of",
"repository": {
"type": "git",
"url": "git://github.com/dominictarr/indexes-of.git"
},
"scripts": {
"test": "node test.js"
},
"version": "1.0.1"
}

View File

@@ -0,0 +1,38 @@
var tape = require('tape')
var indexes = require('./')
tape('indexes of - 2 matches', function (t) {
var x = indexes([1,2,3, 2,4,5,9,8,0], 2)
t.deepEqual(x, [1,3])
t.end()
})
tape('indexes of - 1 match', function (t) {
var x = indexes([1,2,3, 2,4,5,9,8,0], 2)
t.deepEqual(x, [1,3])
t.end()
})
tape('indexes of - empty', function (t) {
var x = indexes([1,2,3, 2,4,5,9,8,0], 24)
t.deepEqual(x, [])
t.end()
})
tape('indexes of - empty', function (t) {
var x = indexes([8,8,8,8,8,8,8], 8)
t.deepEqual(x, [0,1,2,3,4,5,6])
t.end()
})
tape('indexes of - string', function (t) {
var x = indexes('foo bar baz foo', 'foo')
t.deepEqual(x, [0, 12])
t.end()
})