BVB Source Codes

prettier Show FormData.js Source code

Return Download prettier: download FormData.js Source code - Download prettier Source code - Type:.js
  1. /* @flow */
  2.  
  3. // constructor
  4. const a: FormData = new FormData(); // correct
  5. new FormData(''); // incorrect
  6. new FormData(document.createElement('input')); // incorrect
  7. new FormData(document.createElement('form')); // correct
  8.  
  9. // has
  10. const b: boolean = a.has('foo'); // correct
  11.  
  12. // get
  13. const c: ?(string | File) = a.get('foo'); // correct
  14. const d: string = a.get('foo'); // incorrect
  15. const e: Blob = a.get('foo'); // incorrect
  16. const f: ?(string | File | Blob) = a.get('foo'); // incorrect
  17. a.get(2); // incorrect
  18.  
  19. // getAll
  20. const a1: Array<string | File> = a.getAll('foo'); // correct
  21. const a2: Array<string | File | number> = a.getAll('foo'); // incorrect
  22. const a3: Array<string | Blob | File> = a.getAll('foo'); // incorrect
  23. a.getAll(23); // incorrect
  24.  
  25. // set
  26. a.set('foo', 'bar'); // correct
  27. a.set('foo', {}); // incorrect
  28. a.set(2, 'bar'); // incorrect
  29. a.set('foo', 'bar', 'baz'); // incorrect
  30. a.set('bar', new File([], 'q')) // correct
  31. a.set('bar', new File([], 'q'), 'x') // correct
  32. a.set('bar', new File([], 'q'), 2) // incorrect
  33. a.set('bar', new Blob) // correct
  34. a.set('bar', new Blob, 'x') // correct
  35. a.set('bar', new Blob, 2) // incorrect
  36.  
  37. // append
  38. a.append('foo', 'bar'); // correct
  39. a.append('foo', {}); // incorrect
  40. a.append(2, 'bar'); // incorrect
  41. a.append('foo', 'bar', 'baz'); // incorrect
  42. a.append('foo', 'bar'); // correct
  43. a.append('bar', new File([], 'q')) // correct
  44. a.append('bar', new File([], 'q'), 'x') // correct
  45. a.append('bar', new File([], 'q'), 2) // incorrect
  46. a.append('bar', new Blob) // correct
  47. a.append('bar', new Blob, 'x') // correct
  48. a.append('bar', new Blob, 2) // incorrect
  49.  
  50. // delete
  51. a.delete('xx'); // correct
  52. a.delete(3); // incorrect
  53.  
  54. // keys
  55. for (let x: string of a.keys()) {} // correct
  56. for (let x: number of a.keys()) {} // incorrect
  57.  
  58. // values
  59. for (let x: string | File of a.values()) {} // correct
  60. for (let x: string | File | Blob of a.values()) {} // incorrect
  61.  
  62. // entries
  63. for (let [x, y]: [string, string | File] of a.entries()) {} // correct
  64. for (let [x, y]: [string, string | File | Blob] of a.entries()) {} // incorrect
  65. for (let [x, y]: [number, string] of a.entries()) {} // incorrect
  66. for (let [x, y]: [string, number] of a.entries()) {} // incorrect
  67. for (let [x, y]: [number, number] of a.entries()) {} // incorrect
  68.  
downloadFormData.js Source code - Download prettier Source code
Related Source Codes/Software:
storybook - 2017-06-07
ionicons - The premium icon font for Ionic ... 2017-06-07
AsyncDisplayKit - Smooth asynchronous user interfaces for iOS apps. ... 2017-06-07
lottie-android - Render After Effects animations natively on Androi... 2017-06-07
parse-server - Parse-compatible API server module for Node/Expres... 2017-06-07
inferno - An extremely fast, React-like JavaScript library f... 2017-06-08
guetzli - Perceptual JPEG encoder 2017-06-08
cs-video-courses - List of Computer Science courses with video lectur... 2017-06-08
interviews - Everything you need to know to get the job. 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top