WIP - add extractor, generate snippet_data

This commit is contained in:
Stefan Fejes
2019-08-20 15:52:05 +02:00
parent 88084d3d30
commit cc8f1d8a7a
37396 changed files with 4588842 additions and 133 deletions

8
node_modules/parse-headers/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,8 @@
language: node_js
node_js:
- '4'
env:
global:
- secure: K1OWZCmO4PvDis8LANVtqSnQ1DyE0d6ikAEEVWZG5qPzT9kPxXhJPIL+SemOQ6x15ERoGKB3GnWKwRTLnxI4mS3ktEfPAGxHQOtalSKBEdV1ml2n8ZmX9NZMl/la/3l5jcRS9Iwgj1hT2GsNPC1Z51nBY+0QhmS0oCOIRl2Perk=
- secure: BofgLxIrbEev31IAMm+mMhgGifZIV0qKv3oyNhg+rPOo3xhV3ni/BPnMFjc0QcIil40H88JIoUiEWFoTnmrficXHkzWJnd4q2kzF9MhnRvAxKO42ziUEklRP/YCNeXJcVXhyNJhBJTMDiKfUy1EU/6lRETZpW4xxXyNxg1NHhIk=
sudo: false

13
node_modules/parse-headers/.zuul.yml generated vendored Normal file
View File

@ -0,0 +1,13 @@
ui: tape
browsers:
- name: chrome
version: latest
- name: safari
version: latest
- name: firefox
version: latest
- name: internet explorer
version: 8..latest
- name: opera
version: latest

21
node_modules/parse-headers/LICENCE generated vendored Normal file
View File

@ -0,0 +1,21 @@
Copyright (c) 2014 David Björklund
This software is released under the MIT license:
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.

11
node_modules/parse-headers/example.js generated vendored Normal file
View File

@ -0,0 +1,11 @@
var parse = require('./parse-headers')
, headers = [
'Date: Sun, 17 Aug 2014 16:24:52 GMT'
, 'Content-Type: text/html; charset=utf-8'
, 'Transfer-Encoding: chunked'
, 'X-Custom-Header: beep'
, 'X-Custom-Header: boop'
].join('\n')
console.log(parse(headers))

61
node_modules/parse-headers/package.json generated vendored Normal file
View File

@ -0,0 +1,61 @@
{
"_from": "parse-headers@^2.0.0",
"_id": "parse-headers@2.0.2",
"_inBundle": false,
"_integrity": "sha512-/LypJhzFmyBIDYP9aDVgeyEb5sQfbfY5mnDq4hVhlQ69js87wXfmEI5V3xI6vvXasqebp0oCytYFLxsBVfCzSg==",
"_location": "/parse-headers",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "parse-headers@^2.0.0",
"name": "parse-headers",
"escapedName": "parse-headers",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/xhr"
],
"_resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.2.tgz",
"_shasum": "9545e8a4c1ae5eaea7d24992bca890281ed26e34",
"_spec": "parse-headers@^2.0.0",
"_where": "/Users/stefanfejes/Projects/30-seconds-of-python-code/node_modules/xhr",
"author": {
"name": "David Björklund",
"email": "david.bjorklund@gmail.com",
"url": "http://davidbjorklund.com/"
},
"bugs": {
"url": "https://github.com/kesla/parse-headers/issues"
},
"bundleDependencies": false,
"dependencies": {
"for-each": "^0.3.3",
"string.prototype.trim": "^1.1.2"
},
"deprecated": false,
"description": "Parse http headers, works with browserify/xhr",
"devDependencies": {
"tape": "^4.10.1",
"zuul": "^3.7.2"
},
"homepage": "https://github.com/kesla/parse-headers",
"keywords": [
"http",
"headers",
"browserify"
],
"license": "MIT",
"main": "parse-headers.js",
"name": "parse-headers",
"repository": {
"type": "git",
"url": "git+https://github.com/kesla/parse-headers.git"
},
"scripts": {
"test": "zuul test.js"
},
"version": "2.0.2"
}

31
node_modules/parse-headers/parse-headers.js generated vendored Normal file
View File

@ -0,0 +1,31 @@
var trim = require('string.prototype.trim')
, forEach = require('for-each')
, isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
}
module.exports = function (headers) {
if (!headers)
return {}
var result = {}
forEach(
trim(headers).split('\n')
, function (row) {
var index = row.indexOf(':')
, key = trim(row.slice(0, index)).toLowerCase()
, value = trim(row.slice(index + 1))
if (typeof(result[key]) === 'undefined') {
result[key] = value
} else if (isArray(result[key])) {
result[key].push(value)
} else {
result[key] = [ result[key], value ]
}
}
)
return result
}

70
node_modules/parse-headers/readme.md generated vendored Normal file
View File

@ -0,0 +1,70 @@
# parse-headers[![build status](https://secure.travis-ci.org/kesla/parse-headers.svg)](http://travis-ci.org/kesla/parse-headers)
Parse http headers, works with browserify/xhr
[![NPM](https://nodei.co/npm/parse-headers.png?downloads&stars)](https://nodei.co/npm/parse-headers/)
[![NPM](https://nodei.co/npm-dl/parse-headers.png)](https://nodei.co/npm/parse-headers/)
[![Sauce Test Status](https://saucelabs.com/browser-matrix/kesla-xhr-headers.svg)](https://saucelabs.com/u/kesla-xhr-headers)
## Installation
```
npm install parse-headers
```
## Example
### Input
```javascript
var parse = require('./parse-headers')
, headers = [
'Date: Sun, 17 Aug 2014 16:24:52 GMT'
, 'Content-Type: text/html; charset=utf-8'
, 'Transfer-Encoding: chunked'
, 'X-Custom-Header: beep'
, 'X-Custom-Header: boop'
].join('\n')
console.log(parse(headers))
```
### Output
```
{ date: 'Sun, 17 Aug 2014 16:24:52 GMT',
'content-type': 'text/html; charset=utf-8',
'transfer-encoding': 'chunked',
'x-custom-header': [ 'beep', 'boop' ] }
```
## Kudos
Looked at https://github.com/watson/http-headers before creating this.
## Licence
Copyright (c) 2014 David Björklund
This software is released under the MIT license:
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.

70
node_modules/parse-headers/test.js generated vendored Normal file
View File

@ -0,0 +1,70 @@
var test = require('tape')
, parse = require('./parse-headers')
, headers1 = [
''
, 'Date: Sun, 17 Aug 2014 16:24:52 GMT'
, 'Content-Type: text/html; charset=utf-8'
, 'Transfer-Encoding: chunked'
, ''
]
, headers2 = [
''
, 'Date: Sun, 17 Aug 2014 16:24:52 GMT'
, 'Content-Type: text/html; charset=utf-8'
, 'Transfer-Encoding: chunked'
, 'Set-Cookie: Foo'
, 'set-Cookie: bar'
, 'set-cookie: bong'
]
test('sanity check', function (t) {
t.deepEqual(parse(), {})
t.deepEqual(parse(''), {})
t.end()
})
test('simple', function (t) {
t.deepEqual(
parse(headers1.join('\r\n'))
, {
date: 'Sun, 17 Aug 2014 16:24:52 GMT'
, 'content-type': 'text/html; charset=utf-8'
, 'transfer-encoding': 'chunked'
}
)
t.deepEqual(
parse(headers1.join('\n'))
, {
date: 'Sun, 17 Aug 2014 16:24:52 GMT'
, 'content-type': 'text/html; charset=utf-8'
, 'transfer-encoding': 'chunked'
}
)
t.end()
})
test('duplicate keys', function (t) {
t.deepEqual(
parse(headers2.join('\r\n'))
, {
date: 'Sun, 17 Aug 2014 16:24:52 GMT'
, 'content-type': 'text/html; charset=utf-8'
, 'transfer-encoding': 'chunked'
, 'set-cookie': [ 'Foo', 'bar', 'bong' ]
}
)
t.deepEqual(
parse(headers2.join('\n'))
, {
date: 'Sun, 17 Aug 2014 16:24:52 GMT'
, 'content-type': 'text/html; charset=utf-8'
, 'transfer-encoding': 'chunked'
, 'set-cookie': [ 'Foo', 'bar', 'bong' ]
}
)
t.end()
})