done purchases remove, ocr scan, read image
This commit is contained in:
		
							
								
								
									
										1
									
								
								express-server/node_modules/append-field/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								express-server/node_modules/append-field/.npmignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
node_modules/
 | 
			
		||||
							
								
								
									
										21
									
								
								express-server/node_modules/append-field/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								express-server/node_modules/append-field/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2015 Linus Unnebäck
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
							
								
								
									
										44
									
								
								express-server/node_modules/append-field/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								express-server/node_modules/append-field/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
# `append-field`
 | 
			
		||||
 | 
			
		||||
A [W3C HTML JSON forms spec](http://www.w3.org/TR/html-json-forms/) compliant
 | 
			
		||||
field appender (for lack of a better name). Useful for people implementing
 | 
			
		||||
`application/x-www-form-urlencoded` and `multipart/form-data` parsers.
 | 
			
		||||
 | 
			
		||||
It works best on objects created with `Object.create(null)`. Otherwise it might
 | 
			
		||||
conflict with variables from the prototype (e.g. `hasOwnProperty`).
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
npm install --save append-field
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
var appendField = require('append-field')
 | 
			
		||||
var obj = Object.create(null)
 | 
			
		||||
 | 
			
		||||
appendField(obj, 'pets[0][species]', 'Dahut')
 | 
			
		||||
appendField(obj, 'pets[0][name]', 'Hypatia')
 | 
			
		||||
appendField(obj, 'pets[1][species]', 'Felis Stultus')
 | 
			
		||||
appendField(obj, 'pets[1][name]', 'Billie')
 | 
			
		||||
 | 
			
		||||
console.log(obj)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
```text
 | 
			
		||||
{ pets:
 | 
			
		||||
   [ { species: 'Dahut', name: 'Hypatia' },
 | 
			
		||||
     { species: 'Felis Stultus', name: 'Billie' } ] }
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## API
 | 
			
		||||
 | 
			
		||||
### `appendField(store, key, value)`
 | 
			
		||||
 | 
			
		||||
Adds the field named `key` with the value `value` to the object `store`.
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
MIT
 | 
			
		||||
							
								
								
									
										12
									
								
								express-server/node_modules/append-field/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								express-server/node_modules/append-field/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
var parsePath = require('./lib/parse-path')
 | 
			
		||||
var setValue = require('./lib/set-value')
 | 
			
		||||
 | 
			
		||||
function appendField (store, key, value) {
 | 
			
		||||
  var steps = parsePath(key)
 | 
			
		||||
 | 
			
		||||
  steps.reduce(function (context, step) {
 | 
			
		||||
    return setValue(context, step, context[step.key], value)
 | 
			
		||||
  }, store)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = appendField
 | 
			
		||||
							
								
								
									
										53
									
								
								express-server/node_modules/append-field/lib/parse-path.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								express-server/node_modules/append-field/lib/parse-path.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
var reFirstKey = /^[^\[]*/
 | 
			
		||||
var reDigitPath = /^\[(\d+)\]/
 | 
			
		||||
var reNormalPath = /^\[([^\]]+)\]/
 | 
			
		||||
 | 
			
		||||
function parsePath (key) {
 | 
			
		||||
  function failure () {
 | 
			
		||||
    return [{ type: 'object', key: key, last: true }]
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  var firstKey = reFirstKey.exec(key)[0]
 | 
			
		||||
  if (!firstKey) return failure()
 | 
			
		||||
 | 
			
		||||
  var len = key.length
 | 
			
		||||
  var pos = firstKey.length
 | 
			
		||||
  var tail = { type: 'object', key: firstKey }
 | 
			
		||||
  var steps = [tail]
 | 
			
		||||
 | 
			
		||||
  while (pos < len) {
 | 
			
		||||
    var m
 | 
			
		||||
 | 
			
		||||
    if (key[pos] === '[' && key[pos + 1] === ']') {
 | 
			
		||||
      pos += 2
 | 
			
		||||
      tail.append = true
 | 
			
		||||
      if (pos !== len) return failure()
 | 
			
		||||
      continue
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    m = reDigitPath.exec(key.substring(pos))
 | 
			
		||||
    if (m !== null) {
 | 
			
		||||
      pos += m[0].length
 | 
			
		||||
      tail.nextType = 'array'
 | 
			
		||||
      tail = { type: 'array', key: parseInt(m[1], 10) }
 | 
			
		||||
      steps.push(tail)
 | 
			
		||||
      continue
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    m = reNormalPath.exec(key.substring(pos))
 | 
			
		||||
    if (m !== null) {
 | 
			
		||||
      pos += m[0].length
 | 
			
		||||
      tail.nextType = 'object'
 | 
			
		||||
      tail = { type: 'object', key: m[1] }
 | 
			
		||||
      steps.push(tail)
 | 
			
		||||
      continue
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return failure()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  tail.last = true
 | 
			
		||||
  return steps
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = parsePath
 | 
			
		||||
							
								
								
									
										64
									
								
								express-server/node_modules/append-field/lib/set-value.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								express-server/node_modules/append-field/lib/set-value.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
function valueType (value) {
 | 
			
		||||
  if (value === undefined) return 'undefined'
 | 
			
		||||
  if (Array.isArray(value)) return 'array'
 | 
			
		||||
  if (typeof value === 'object') return 'object'
 | 
			
		||||
  return 'scalar'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setLastValue (context, step, currentValue, entryValue) {
 | 
			
		||||
  switch (valueType(currentValue)) {
 | 
			
		||||
    case 'undefined':
 | 
			
		||||
      if (step.append) {
 | 
			
		||||
        context[step.key] = [entryValue]
 | 
			
		||||
      } else {
 | 
			
		||||
        context[step.key] = entryValue
 | 
			
		||||
      }
 | 
			
		||||
      break
 | 
			
		||||
    case 'array':
 | 
			
		||||
      context[step.key].push(entryValue)
 | 
			
		||||
      break
 | 
			
		||||
    case 'object':
 | 
			
		||||
      return setLastValue(currentValue, { type: 'object', key: '', last: true }, currentValue[''], entryValue)
 | 
			
		||||
    case 'scalar':
 | 
			
		||||
      context[step.key] = [context[step.key], entryValue]
 | 
			
		||||
      break
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return context
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function setValue (context, step, currentValue, entryValue) {
 | 
			
		||||
  if (step.last) return setLastValue(context, step, currentValue, entryValue)
 | 
			
		||||
 | 
			
		||||
  var obj
 | 
			
		||||
  switch (valueType(currentValue)) {
 | 
			
		||||
    case 'undefined':
 | 
			
		||||
      if (step.nextType === 'array') {
 | 
			
		||||
        context[step.key] = []
 | 
			
		||||
      } else {
 | 
			
		||||
        context[step.key] = Object.create(null)
 | 
			
		||||
      }
 | 
			
		||||
      return context[step.key]
 | 
			
		||||
    case 'object':
 | 
			
		||||
      return context[step.key]
 | 
			
		||||
    case 'array':
 | 
			
		||||
      if (step.nextType === 'array') {
 | 
			
		||||
        return currentValue
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      obj = Object.create(null)
 | 
			
		||||
      context[step.key] = obj
 | 
			
		||||
      currentValue.forEach(function (item, i) {
 | 
			
		||||
        if (item !== undefined) obj['' + i] = item
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      return obj
 | 
			
		||||
    case 'scalar':
 | 
			
		||||
      obj = Object.create(null)
 | 
			
		||||
      obj[''] = currentValue
 | 
			
		||||
      context[step.key] = obj
 | 
			
		||||
      return obj
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = setValue
 | 
			
		||||
							
								
								
									
										52
									
								
								express-server/node_modules/append-field/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								express-server/node_modules/append-field/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
			
		||||
{
 | 
			
		||||
  "_from": "append-field@^1.0.0",
 | 
			
		||||
  "_id": "append-field@1.0.0",
 | 
			
		||||
  "_inBundle": false,
 | 
			
		||||
  "_integrity": "sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY=",
 | 
			
		||||
  "_location": "/append-field",
 | 
			
		||||
  "_phantomChildren": {},
 | 
			
		||||
  "_requested": {
 | 
			
		||||
    "type": "range",
 | 
			
		||||
    "registry": true,
 | 
			
		||||
    "raw": "append-field@^1.0.0",
 | 
			
		||||
    "name": "append-field",
 | 
			
		||||
    "escapedName": "append-field",
 | 
			
		||||
    "rawSpec": "^1.0.0",
 | 
			
		||||
    "saveSpec": null,
 | 
			
		||||
    "fetchSpec": "^1.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "_requiredBy": [
 | 
			
		||||
    "/multer"
 | 
			
		||||
  ],
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",
 | 
			
		||||
  "_shasum": "1e3440e915f0b1203d23748e78edd7b9b5b43e56",
 | 
			
		||||
  "_spec": "append-field@^1.0.0",
 | 
			
		||||
  "_where": "D:\\5CHITM\\Diplomarbeit\\repos\\SmartShopper\\express-server\\node_modules\\multer",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Linus Unnebäck",
 | 
			
		||||
    "email": "linus@folkdatorn.se"
 | 
			
		||||
  },
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/LinusU/node-append-field/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "bundleDependencies": false,
 | 
			
		||||
  "deprecated": false,
 | 
			
		||||
  "description": "A [W3C HTML JSON forms spec](http://www.w3.org/TR/html-json-forms/) compliant field appender (for lack of a better name). Useful for people implementing `application/x-www-form-urlencoded` and `multipart/form-data` parsers.",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "mocha": "^2.2.4",
 | 
			
		||||
    "standard": "^6.0.5",
 | 
			
		||||
    "testdata-w3c-json-form": "^0.2.0"
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://github.com/LinusU/node-append-field#readme",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "name": "append-field",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git+ssh://git@github.com/LinusU/node-append-field.git"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "standard && mocha"
 | 
			
		||||
  },
 | 
			
		||||
  "version": "1.0.0"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										19
									
								
								express-server/node_modules/append-field/test/forms.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								express-server/node_modules/append-field/test/forms.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
/* eslint-env mocha */
 | 
			
		||||
 | 
			
		||||
var assert = require('assert')
 | 
			
		||||
var appendField = require('../')
 | 
			
		||||
var testData = require('testdata-w3c-json-form')
 | 
			
		||||
 | 
			
		||||
describe('Append Field', function () {
 | 
			
		||||
  for (var test of testData) {
 | 
			
		||||
    it('handles ' + test.name, function () {
 | 
			
		||||
      var store = Object.create(null)
 | 
			
		||||
 | 
			
		||||
      for (var field of test.fields) {
 | 
			
		||||
        appendField(store, field.key, field.value)
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      assert.deepEqual(store, test.expected)
 | 
			
		||||
    })
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user