@agnostack/verifyd 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/CODE_OF_CONDUCT.md +132 -0
- package/LICENSE +21 -0
- package/README.md +93 -0
- package/SECURITY.md +18 -0
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +20 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/types.d.ts +1 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils/errors.d.ts +6 -0
- package/dist/lib/utils/errors.d.ts.map +1 -0
- package/dist/lib/utils/errors.js +26 -0
- package/dist/lib/utils/errors.js.map +1 -0
- package/dist/lib/utils/index.d.ts +3 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +19 -0
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/utils/rawbody.d.ts +2 -0
- package/dist/lib/utils/rawbody.d.ts.map +1 -0
- package/dist/lib/utils/rawbody.js +60 -0
- package/dist/lib/utils/rawbody.js.map +1 -0
- package/dist/lib/verification.d.ts +10 -0
- package/dist/lib/verification.d.ts.map +1 -0
- package/dist/lib/verification.js +84 -0
- package/dist/lib/verification.js.map +1 -0
- package/dist/react/hooks/index.d.ts +2 -0
- package/dist/react/hooks/index.d.ts.map +1 -0
- package/dist/react/hooks/index.js +18 -0
- package/dist/react/hooks/index.js.map +1 -0
- package/dist/react/hooks/useVerification.d.ts +8 -0
- package/dist/react/hooks/useVerification.d.ts.map +1 -0
- package/dist/react/hooks/useVerification.js +52 -0
- package/dist/react/hooks/useVerification.js.map +1 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +19 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/types.d.ts +1 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react/types.js +1 -0
- package/dist/react/types.js.map +1 -0
- package/dist/shared/WebCrypto.d.ts +55 -0
- package/dist/shared/WebCrypto.d.ts.map +1 -0
- package/dist/shared/WebCrypto.js +342 -0
- package/dist/shared/WebCrypto.js.map +1 -0
- package/dist/shared/datetime.d.ts +96 -0
- package/dist/shared/datetime.d.ts.map +1 -0
- package/dist/shared/datetime.js +295 -0
- package/dist/shared/datetime.js.map +1 -0
- package/dist/shared/display.d.ts +100 -0
- package/dist/shared/display.d.ts.map +1 -0
- package/dist/shared/display.js +481 -0
- package/dist/shared/display.js.map +1 -0
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +28 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/request.d.ts +16 -0
- package/dist/shared/request.d.ts.map +1 -0
- package/dist/shared/request.js +60 -0
- package/dist/shared/request.js.map +1 -0
- package/dist/shared/types.d.ts +1 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +1 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/shared/verification.d.ts +31 -0
- package/dist/shared/verification.d.ts.map +1 -0
- package/dist/shared/verification.js +91 -0
- package/dist/shared/verification.js.map +1 -0
- package/dist/umd/lib/index.js +2204 -0
- package/dist/umd/lib/index.js.map +1 -0
- package/dist/umd/lib/lib/index.d.ts +4 -0
- package/dist/umd/lib/lib/index.d.ts.map +1 -0
- package/dist/umd/lib/lib/types.d.ts +1 -0
- package/dist/umd/lib/lib/types.d.ts.map +1 -0
- package/dist/umd/lib/lib/utils/errors.d.ts +6 -0
- package/dist/umd/lib/lib/utils/errors.d.ts.map +1 -0
- package/dist/umd/lib/lib/utils/index.d.ts +3 -0
- package/dist/umd/lib/lib/utils/index.d.ts.map +1 -0
- package/dist/umd/lib/lib/utils/rawbody.d.ts +2 -0
- package/dist/umd/lib/lib/utils/rawbody.d.ts.map +1 -0
- package/dist/umd/lib/lib/verification.d.ts +10 -0
- package/dist/umd/lib/lib/verification.d.ts.map +1 -0
- package/dist/umd/lib/react/hooks/index.d.ts +2 -0
- package/dist/umd/lib/react/hooks/index.d.ts.map +1 -0
- package/dist/umd/lib/react/hooks/useVerification.d.ts +8 -0
- package/dist/umd/lib/react/hooks/useVerification.d.ts.map +1 -0
- package/dist/umd/lib/react/index.d.ts +3 -0
- package/dist/umd/lib/react/index.d.ts.map +1 -0
- package/dist/umd/lib/react/types.d.ts +1 -0
- package/dist/umd/lib/react/types.d.ts.map +1 -0
- package/dist/umd/lib/shared/WebCrypto.d.ts +55 -0
- package/dist/umd/lib/shared/WebCrypto.d.ts.map +1 -0
- package/dist/umd/lib/shared/datetime.d.ts +96 -0
- package/dist/umd/lib/shared/datetime.d.ts.map +1 -0
- package/dist/umd/lib/shared/display.d.ts +100 -0
- package/dist/umd/lib/shared/display.d.ts.map +1 -0
- package/dist/umd/lib/shared/index.d.ts +6 -0
- package/dist/umd/lib/shared/index.d.ts.map +1 -0
- package/dist/umd/lib/shared/request.d.ts +16 -0
- package/dist/umd/lib/shared/request.d.ts.map +1 -0
- package/dist/umd/lib/shared/types.d.ts +1 -0
- package/dist/umd/lib/shared/types.d.ts.map +1 -0
- package/dist/umd/lib/shared/verification.d.ts +31 -0
- package/dist/umd/lib/shared/verification.d.ts.map +1 -0
- package/node_modules/browser-monads-ts/LICENSE +21 -0
- package/node_modules/browser-monads-ts/README.md +46 -0
- package/node_modules/browser-monads-ts/dist/browser-monads-ts.cjs.js +2 -0
- package/node_modules/browser-monads-ts/dist/browser-monads-ts.cjs.js.map +1 -0
- package/node_modules/browser-monads-ts/dist/browser-monads-ts.es.js +12 -0
- package/node_modules/browser-monads-ts/dist/browser-monads-ts.es.js.map +1 -0
- package/node_modules/browser-monads-ts/dist/index.d.ts +5 -0
- package/node_modules/browser-monads-ts/dist/index.d.ts.map +1 -0
- package/node_modules/browser-monads-ts/package.json +79 -0
- package/node_modules/bytes/History.md +97 -0
- package/node_modules/bytes/LICENSE +23 -0
- package/node_modules/bytes/Readme.md +152 -0
- package/node_modules/bytes/index.js +170 -0
- package/node_modules/bytes/package.json +42 -0
- package/node_modules/depd/History.md +103 -0
- package/node_modules/depd/LICENSE +22 -0
- package/node_modules/depd/Readme.md +280 -0
- package/node_modules/depd/index.js +538 -0
- package/node_modules/depd/lib/browser/index.js +77 -0
- package/node_modules/depd/package.json +45 -0
- package/node_modules/http-errors/HISTORY.md +180 -0
- package/node_modules/http-errors/LICENSE +23 -0
- package/node_modules/http-errors/README.md +169 -0
- package/node_modules/http-errors/index.js +289 -0
- package/node_modules/http-errors/package.json +50 -0
- package/node_modules/iconv-lite/Changelog.md +162 -0
- package/node_modules/iconv-lite/LICENSE +21 -0
- package/node_modules/iconv-lite/README.md +156 -0
- package/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
- package/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
- package/node_modules/iconv-lite/encodings/index.js +22 -0
- package/node_modules/iconv-lite/encodings/internal.js +188 -0
- package/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
- package/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
- package/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/node_modules/iconv-lite/encodings/utf16.js +177 -0
- package/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/node_modules/iconv-lite/lib/extend-node.js +217 -0
- package/node_modules/iconv-lite/lib/index.d.ts +24 -0
- package/node_modules/iconv-lite/lib/index.js +153 -0
- package/node_modules/iconv-lite/lib/streams.js +121 -0
- package/node_modules/iconv-lite/package.json +46 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -0
- package/node_modules/nothing-mock/LICENSE +21 -0
- package/node_modules/nothing-mock/README.md +266 -0
- package/node_modules/nothing-mock/dist/nothing-mock.es.js +2 -0
- package/node_modules/nothing-mock/dist/nothing-mock.es.js.map +1 -0
- package/node_modules/nothing-mock/dist/nothing-mock.js +2 -0
- package/node_modules/nothing-mock/dist/nothing-mock.js.map +1 -0
- package/node_modules/nothing-mock/dist/nothing-mock.modern.js +2 -0
- package/node_modules/nothing-mock/dist/nothing-mock.modern.js.map +1 -0
- package/node_modules/nothing-mock/dist/nothing-mock.umd.js +2 -0
- package/node_modules/nothing-mock/dist/nothing-mock.umd.js.map +1 -0
- package/node_modules/nothing-mock/index.d.ts +6 -0
- package/node_modules/nothing-mock/package.json +29 -0
- package/node_modules/nothing-mock/src/index.js +15 -0
- package/node_modules/raw-body/HISTORY.md +308 -0
- package/node_modules/raw-body/LICENSE +22 -0
- package/node_modules/raw-body/README.md +223 -0
- package/node_modules/raw-body/SECURITY.md +24 -0
- package/node_modules/raw-body/index.d.ts +87 -0
- package/node_modules/raw-body/index.js +336 -0
- package/node_modules/raw-body/package.json +49 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/setprototypeof/LICENSE +13 -0
- package/node_modules/setprototypeof/README.md +31 -0
- package/node_modules/setprototypeof/index.d.ts +2 -0
- package/node_modules/setprototypeof/index.js +17 -0
- package/node_modules/setprototypeof/package.json +38 -0
- package/node_modules/setprototypeof/test/index.js +24 -0
- package/node_modules/statuses/HISTORY.md +82 -0
- package/node_modules/statuses/LICENSE +23 -0
- package/node_modules/statuses/README.md +136 -0
- package/node_modules/statuses/codes.json +65 -0
- package/node_modules/statuses/index.js +146 -0
- package/node_modules/statuses/package.json +49 -0
- package/node_modules/toidentifier/HISTORY.md +9 -0
- package/node_modules/toidentifier/LICENSE +21 -0
- package/node_modules/toidentifier/README.md +61 -0
- package/node_modules/toidentifier/index.js +32 -0
- package/node_modules/toidentifier/package.json +38 -0
- package/node_modules/unpipe/HISTORY.md +4 -0
- package/node_modules/unpipe/LICENSE +22 -0
- package/node_modules/unpipe/README.md +43 -0
- package/node_modules/unpipe/index.js +69 -0
- package/node_modules/unpipe/package.json +27 -0
- package/package.json +127 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/* eslint-disable node/no-deprecated-api */
|
|
2
|
+
|
|
3
|
+
'use strict'
|
|
4
|
+
|
|
5
|
+
var test = require('tape')
|
|
6
|
+
|
|
7
|
+
var buffer = require('buffer')
|
|
8
|
+
|
|
9
|
+
var index = require('./')
|
|
10
|
+
var safer = require('./safer')
|
|
11
|
+
var dangerous = require('./dangerous')
|
|
12
|
+
|
|
13
|
+
/* Inheritance tests */
|
|
14
|
+
|
|
15
|
+
test('Default is Safer', function (t) {
|
|
16
|
+
t.equal(index, safer)
|
|
17
|
+
t.notEqual(safer, dangerous)
|
|
18
|
+
t.notEqual(index, dangerous)
|
|
19
|
+
t.end()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('Is not a function', function (t) {
|
|
23
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
24
|
+
t.equal(typeof impl, 'object')
|
|
25
|
+
t.equal(typeof impl.Buffer, 'object')
|
|
26
|
+
});
|
|
27
|
+
[buffer].forEach(function (impl) {
|
|
28
|
+
t.equal(typeof impl, 'object')
|
|
29
|
+
t.equal(typeof impl.Buffer, 'function')
|
|
30
|
+
})
|
|
31
|
+
t.end()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('Constructor throws', function (t) {
|
|
35
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
36
|
+
t.throws(function () { impl.Buffer() })
|
|
37
|
+
t.throws(function () { impl.Buffer(0) })
|
|
38
|
+
t.throws(function () { impl.Buffer('a') })
|
|
39
|
+
t.throws(function () { impl.Buffer('a', 'utf-8') })
|
|
40
|
+
t.throws(function () { return new impl.Buffer() })
|
|
41
|
+
t.throws(function () { return new impl.Buffer(0) })
|
|
42
|
+
t.throws(function () { return new impl.Buffer('a') })
|
|
43
|
+
t.throws(function () { return new impl.Buffer('a', 'utf-8') })
|
|
44
|
+
})
|
|
45
|
+
t.end()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('Safe methods exist', function (t) {
|
|
49
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
50
|
+
t.equal(typeof impl.Buffer.alloc, 'function', 'alloc')
|
|
51
|
+
t.equal(typeof impl.Buffer.from, 'function', 'from')
|
|
52
|
+
})
|
|
53
|
+
t.end()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('Unsafe methods exist only in Dangerous', function (t) {
|
|
57
|
+
[index, safer].forEach(function (impl) {
|
|
58
|
+
t.equal(typeof impl.Buffer.allocUnsafe, 'undefined')
|
|
59
|
+
t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined')
|
|
60
|
+
});
|
|
61
|
+
[dangerous].forEach(function (impl) {
|
|
62
|
+
t.equal(typeof impl.Buffer.allocUnsafe, 'function')
|
|
63
|
+
t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function')
|
|
64
|
+
})
|
|
65
|
+
t.end()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('Generic methods/properties are defined and equal', function (t) {
|
|
69
|
+
['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) {
|
|
70
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
71
|
+
t.equal(impl.Buffer[method], buffer.Buffer[method], method)
|
|
72
|
+
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
t.end()
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
test('Built-in buffer static methods/properties are inherited', function (t) {
|
|
79
|
+
Object.keys(buffer).forEach(function (method) {
|
|
80
|
+
if (method === 'SlowBuffer' || method === 'Buffer') return;
|
|
81
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
82
|
+
t.equal(impl[method], buffer[method], method)
|
|
83
|
+
t.notEqual(typeof impl[method], 'undefined', method)
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
t.end()
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
test('Built-in Buffer static methods/properties are inherited', function (t) {
|
|
90
|
+
Object.keys(buffer.Buffer).forEach(function (method) {
|
|
91
|
+
if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
|
|
92
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
93
|
+
t.equal(impl.Buffer[method], buffer.Buffer[method], method)
|
|
94
|
+
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
|
|
95
|
+
})
|
|
96
|
+
})
|
|
97
|
+
t.end()
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('.prototype property of Buffer is inherited', function (t) {
|
|
101
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
102
|
+
t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype')
|
|
103
|
+
t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype')
|
|
104
|
+
})
|
|
105
|
+
t.end()
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
test('All Safer methods are present in Dangerous', function (t) {
|
|
109
|
+
Object.keys(safer).forEach(function (method) {
|
|
110
|
+
if (method === 'Buffer') return;
|
|
111
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
112
|
+
t.equal(impl[method], safer[method], method)
|
|
113
|
+
if (method !== 'kStringMaxLength') {
|
|
114
|
+
t.notEqual(typeof impl[method], 'undefined', method)
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
})
|
|
118
|
+
Object.keys(safer.Buffer).forEach(function (method) {
|
|
119
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
120
|
+
t.equal(impl.Buffer[method], safer.Buffer[method], method)
|
|
121
|
+
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
t.end()
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
test('Safe methods from Dangerous methods are present in Safer', function (t) {
|
|
128
|
+
Object.keys(dangerous).forEach(function (method) {
|
|
129
|
+
if (method === 'Buffer') return;
|
|
130
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
131
|
+
t.equal(impl[method], dangerous[method], method)
|
|
132
|
+
if (method !== 'kStringMaxLength') {
|
|
133
|
+
t.notEqual(typeof impl[method], 'undefined', method)
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
Object.keys(dangerous.Buffer).forEach(function (method) {
|
|
138
|
+
if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return;
|
|
139
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
140
|
+
t.equal(impl.Buffer[method], dangerous.Buffer[method], method)
|
|
141
|
+
t.notEqual(typeof impl.Buffer[method], 'undefined', method)
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
t.end()
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
/* Behaviour tests */
|
|
148
|
+
|
|
149
|
+
test('Methods return Buffers', function (t) {
|
|
150
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
151
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0)))
|
|
152
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10)))
|
|
153
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a')))
|
|
154
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10)))
|
|
155
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x')))
|
|
156
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab')))
|
|
157
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('')))
|
|
158
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string')))
|
|
159
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8')))
|
|
160
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64')))
|
|
161
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3])))
|
|
162
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3]))))
|
|
163
|
+
t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([])))
|
|
164
|
+
});
|
|
165
|
+
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
|
|
166
|
+
t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0)))
|
|
167
|
+
t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10)))
|
|
168
|
+
})
|
|
169
|
+
t.end()
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
test('Constructor is buffer.Buffer', function (t) {
|
|
173
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
174
|
+
t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer)
|
|
175
|
+
t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer)
|
|
176
|
+
t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer)
|
|
177
|
+
t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer)
|
|
178
|
+
t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer)
|
|
179
|
+
t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer)
|
|
180
|
+
t.equal(impl.Buffer.from('').constructor, buffer.Buffer)
|
|
181
|
+
t.equal(impl.Buffer.from('string').constructor, buffer.Buffer)
|
|
182
|
+
t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer)
|
|
183
|
+
t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer)
|
|
184
|
+
t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer)
|
|
185
|
+
t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer)
|
|
186
|
+
t.equal(impl.Buffer.from([]).constructor, buffer.Buffer)
|
|
187
|
+
});
|
|
188
|
+
[0, 10, 100].forEach(function (arg) {
|
|
189
|
+
t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer)
|
|
190
|
+
t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor)
|
|
191
|
+
})
|
|
192
|
+
t.end()
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
test('Invalid calls throw', function (t) {
|
|
196
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
197
|
+
t.throws(function () { impl.Buffer.from(0) })
|
|
198
|
+
t.throws(function () { impl.Buffer.from(10) })
|
|
199
|
+
t.throws(function () { impl.Buffer.from(10, 'utf-8') })
|
|
200
|
+
t.throws(function () { impl.Buffer.from('string', 'invalid encoding') })
|
|
201
|
+
t.throws(function () { impl.Buffer.from(-10) })
|
|
202
|
+
t.throws(function () { impl.Buffer.from(1e90) })
|
|
203
|
+
t.throws(function () { impl.Buffer.from(Infinity) })
|
|
204
|
+
t.throws(function () { impl.Buffer.from(-Infinity) })
|
|
205
|
+
t.throws(function () { impl.Buffer.from(NaN) })
|
|
206
|
+
t.throws(function () { impl.Buffer.from(null) })
|
|
207
|
+
t.throws(function () { impl.Buffer.from(undefined) })
|
|
208
|
+
t.throws(function () { impl.Buffer.from() })
|
|
209
|
+
t.throws(function () { impl.Buffer.from({}) })
|
|
210
|
+
t.throws(function () { impl.Buffer.alloc('') })
|
|
211
|
+
t.throws(function () { impl.Buffer.alloc('string') })
|
|
212
|
+
t.throws(function () { impl.Buffer.alloc('string', 'utf-8') })
|
|
213
|
+
t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') })
|
|
214
|
+
t.throws(function () { impl.Buffer.alloc(-10) })
|
|
215
|
+
t.throws(function () { impl.Buffer.alloc(1e90) })
|
|
216
|
+
t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) })
|
|
217
|
+
t.throws(function () { impl.Buffer.alloc(Infinity) })
|
|
218
|
+
t.throws(function () { impl.Buffer.alloc(-Infinity) })
|
|
219
|
+
t.throws(function () { impl.Buffer.alloc(null) })
|
|
220
|
+
t.throws(function () { impl.Buffer.alloc(undefined) })
|
|
221
|
+
t.throws(function () { impl.Buffer.alloc() })
|
|
222
|
+
t.throws(function () { impl.Buffer.alloc([]) })
|
|
223
|
+
t.throws(function () { impl.Buffer.alloc([0, 42, 3]) })
|
|
224
|
+
t.throws(function () { impl.Buffer.alloc({}) })
|
|
225
|
+
});
|
|
226
|
+
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
|
|
227
|
+
t.throws(function () { dangerous.Buffer[method]('') })
|
|
228
|
+
t.throws(function () { dangerous.Buffer[method]('string') })
|
|
229
|
+
t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') })
|
|
230
|
+
t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) })
|
|
231
|
+
t.throws(function () { dangerous.Buffer[method](Infinity) })
|
|
232
|
+
if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) {
|
|
233
|
+
t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0')
|
|
234
|
+
} else {
|
|
235
|
+
t.throws(function () { dangerous.Buffer[method](-10) })
|
|
236
|
+
t.throws(function () { dangerous.Buffer[method](-1e90) })
|
|
237
|
+
t.throws(function () { dangerous.Buffer[method](-Infinity) })
|
|
238
|
+
}
|
|
239
|
+
t.throws(function () { dangerous.Buffer[method](null) })
|
|
240
|
+
t.throws(function () { dangerous.Buffer[method](undefined) })
|
|
241
|
+
t.throws(function () { dangerous.Buffer[method]() })
|
|
242
|
+
t.throws(function () { dangerous.Buffer[method]([]) })
|
|
243
|
+
t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) })
|
|
244
|
+
t.throws(function () { dangerous.Buffer[method]({}) })
|
|
245
|
+
})
|
|
246
|
+
t.end()
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
test('Buffers have appropriate lengths', function (t) {
|
|
250
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
251
|
+
t.equal(impl.Buffer.alloc(0).length, 0)
|
|
252
|
+
t.equal(impl.Buffer.alloc(10).length, 10)
|
|
253
|
+
t.equal(impl.Buffer.from('').length, 0)
|
|
254
|
+
t.equal(impl.Buffer.from('string').length, 6)
|
|
255
|
+
t.equal(impl.Buffer.from('string', 'utf-8').length, 6)
|
|
256
|
+
t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11)
|
|
257
|
+
t.equal(impl.Buffer.from([0, 42, 3]).length, 3)
|
|
258
|
+
t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3)
|
|
259
|
+
t.equal(impl.Buffer.from([]).length, 0)
|
|
260
|
+
});
|
|
261
|
+
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
|
|
262
|
+
t.equal(dangerous.Buffer[method](0).length, 0)
|
|
263
|
+
t.equal(dangerous.Buffer[method](10).length, 10)
|
|
264
|
+
})
|
|
265
|
+
t.end()
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
test('Buffers have appropriate lengths (2)', function (t) {
|
|
269
|
+
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
|
|
270
|
+
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
|
|
271
|
+
var ok = true;
|
|
272
|
+
[ safer.Buffer.alloc,
|
|
273
|
+
dangerous.Buffer.allocUnsafe,
|
|
274
|
+
dangerous.Buffer.allocUnsafeSlow
|
|
275
|
+
].forEach(function (method) {
|
|
276
|
+
for (var i = 0; i < 1e2; i++) {
|
|
277
|
+
var length = Math.round(Math.random() * 1e5)
|
|
278
|
+
var buf = method(length)
|
|
279
|
+
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
|
280
|
+
if (buf.length !== length) ok = false
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
t.ok(ok)
|
|
284
|
+
t.end()
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
test('.alloc(size) is zero-filled and has correct length', function (t) {
|
|
288
|
+
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
|
|
289
|
+
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
|
|
290
|
+
var ok = true
|
|
291
|
+
for (var i = 0; i < 1e2; i++) {
|
|
292
|
+
var length = Math.round(Math.random() * 2e6)
|
|
293
|
+
var buf = index.Buffer.alloc(length)
|
|
294
|
+
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
|
295
|
+
if (buf.length !== length) ok = false
|
|
296
|
+
var j
|
|
297
|
+
for (j = 0; j < length; j++) {
|
|
298
|
+
if (buf[j] !== 0) ok = false
|
|
299
|
+
}
|
|
300
|
+
buf.fill(1)
|
|
301
|
+
for (j = 0; j < length; j++) {
|
|
302
|
+
if (buf[j] !== 1) ok = false
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
t.ok(ok)
|
|
306
|
+
t.end()
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) {
|
|
310
|
+
['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) {
|
|
311
|
+
var ok = true
|
|
312
|
+
for (var i = 0; i < 1e2; i++) {
|
|
313
|
+
var length = Math.round(Math.random() * 2e6)
|
|
314
|
+
var buf = dangerous.Buffer[method](length)
|
|
315
|
+
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
|
316
|
+
if (buf.length !== length) ok = false
|
|
317
|
+
buf.fill(0, 0, length)
|
|
318
|
+
var j
|
|
319
|
+
for (j = 0; j < length; j++) {
|
|
320
|
+
if (buf[j] !== 0) ok = false
|
|
321
|
+
}
|
|
322
|
+
buf.fill(1, 0, length)
|
|
323
|
+
for (j = 0; j < length; j++) {
|
|
324
|
+
if (buf[j] !== 1) ok = false
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
t.ok(ok, method)
|
|
328
|
+
})
|
|
329
|
+
t.end()
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
test('.alloc(size, fill) is `fill`-filled', function (t) {
|
|
333
|
+
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
|
|
334
|
+
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
|
|
335
|
+
var ok = true
|
|
336
|
+
for (var i = 0; i < 1e2; i++) {
|
|
337
|
+
var length = Math.round(Math.random() * 2e6)
|
|
338
|
+
var fill = Math.round(Math.random() * 255)
|
|
339
|
+
var buf = index.Buffer.alloc(length, fill)
|
|
340
|
+
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
|
341
|
+
if (buf.length !== length) ok = false
|
|
342
|
+
for (var j = 0; j < length; j++) {
|
|
343
|
+
if (buf[j] !== fill) ok = false
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
t.ok(ok)
|
|
347
|
+
t.end()
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
test('.alloc(size, fill) is `fill`-filled', function (t) {
|
|
351
|
+
t.equal(index.Buffer.alloc, safer.Buffer.alloc)
|
|
352
|
+
t.equal(index.Buffer.alloc, dangerous.Buffer.alloc)
|
|
353
|
+
var ok = true
|
|
354
|
+
for (var i = 0; i < 1e2; i++) {
|
|
355
|
+
var length = Math.round(Math.random() * 2e6)
|
|
356
|
+
var fill = Math.round(Math.random() * 255)
|
|
357
|
+
var buf = index.Buffer.alloc(length, fill)
|
|
358
|
+
if (!buffer.Buffer.isBuffer(buf)) ok = false
|
|
359
|
+
if (buf.length !== length) ok = false
|
|
360
|
+
for (var j = 0; j < length; j++) {
|
|
361
|
+
if (buf[j] !== fill) ok = false
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
t.ok(ok)
|
|
365
|
+
t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97))
|
|
366
|
+
t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98))
|
|
367
|
+
|
|
368
|
+
var tmp = new buffer.Buffer(2)
|
|
369
|
+
tmp.fill('ok')
|
|
370
|
+
if (tmp[1] === tmp[0]) {
|
|
371
|
+
// Outdated Node.js
|
|
372
|
+
t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo'))
|
|
373
|
+
} else {
|
|
374
|
+
t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko'))
|
|
375
|
+
}
|
|
376
|
+
t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok'))
|
|
377
|
+
|
|
378
|
+
t.end()
|
|
379
|
+
})
|
|
380
|
+
|
|
381
|
+
test('safer.Buffer.from returns results same as Buffer constructor', function (t) {
|
|
382
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
383
|
+
t.deepEqual(impl.Buffer.from(''), new buffer.Buffer(''))
|
|
384
|
+
t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string'))
|
|
385
|
+
t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8'))
|
|
386
|
+
t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64'))
|
|
387
|
+
t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3]))
|
|
388
|
+
t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3])))
|
|
389
|
+
t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([]))
|
|
390
|
+
})
|
|
391
|
+
t.end()
|
|
392
|
+
})
|
|
393
|
+
|
|
394
|
+
test('safer.Buffer.from returns consistent results', function (t) {
|
|
395
|
+
[index, safer, dangerous].forEach(function (impl) {
|
|
396
|
+
t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0))
|
|
397
|
+
t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0))
|
|
398
|
+
t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0))
|
|
399
|
+
t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string'))
|
|
400
|
+
t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103]))
|
|
401
|
+
t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string')))
|
|
402
|
+
t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree'))
|
|
403
|
+
t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree'))
|
|
404
|
+
})
|
|
405
|
+
t.end()
|
|
406
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright (c) 2015, Wes Todd
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
5
|
+
copyright notice and this permission notice appear in all copies.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
8
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
9
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
10
|
+
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
11
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
12
|
+
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
13
|
+
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Polyfill for `Object.setPrototypeOf`
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.org/package/setprototypeof)
|
|
4
|
+
[](https://npmjs.org/package/setprototypeof)
|
|
5
|
+
[](https://github.com/standard/standard)
|
|
6
|
+
|
|
7
|
+
A simple cross platform implementation to set the prototype of an instianted object. Supports all modern browsers and at least back to IE8.
|
|
8
|
+
|
|
9
|
+
## Usage:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
$ npm install --save setprototypeof
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
var setPrototypeOf = require('setprototypeof')
|
|
17
|
+
|
|
18
|
+
var obj = {}
|
|
19
|
+
setPrototypeOf(obj, {
|
|
20
|
+
foo: function () {
|
|
21
|
+
return 'bar'
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
obj.foo() // bar
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
TypeScript is also supported:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import setPrototypeOf from 'setprototypeof'
|
|
31
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
/* eslint no-proto: 0 */
|
|
3
|
+
module.exports = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties)
|
|
4
|
+
|
|
5
|
+
function setProtoOf (obj, proto) {
|
|
6
|
+
obj.__proto__ = proto
|
|
7
|
+
return obj
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function mixinProperties (obj, proto) {
|
|
11
|
+
for (var prop in proto) {
|
|
12
|
+
if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
|
|
13
|
+
obj[prop] = proto[prop]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return obj
|
|
17
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "setprototypeof",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "A small polyfill for Object.setprototypeof",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"typings": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "standard && mocha",
|
|
9
|
+
"testallversions": "npm run node010 && npm run node4 && npm run node6 && npm run node9 && npm run node11",
|
|
10
|
+
"testversion": "docker run -it --rm -v $(PWD):/usr/src/app -w /usr/src/app node:${NODE_VER} npm install mocha@${MOCHA_VER:-latest} && npm t",
|
|
11
|
+
"node010": "NODE_VER=0.10 MOCHA_VER=3 npm run testversion",
|
|
12
|
+
"node4": "NODE_VER=4 npm run testversion",
|
|
13
|
+
"node6": "NODE_VER=6 npm run testversion",
|
|
14
|
+
"node9": "NODE_VER=9 npm run testversion",
|
|
15
|
+
"node11": "NODE_VER=11 npm run testversion",
|
|
16
|
+
"prepublishOnly": "npm t",
|
|
17
|
+
"postpublish": "git push origin && git push origin --tags"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/wesleytodd/setprototypeof.git"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"polyfill",
|
|
25
|
+
"object",
|
|
26
|
+
"setprototypeof"
|
|
27
|
+
],
|
|
28
|
+
"author": "Wes Todd",
|
|
29
|
+
"license": "ISC",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/wesleytodd/setprototypeof/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/wesleytodd/setprototypeof",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"mocha": "^6.1.4",
|
|
36
|
+
"standard": "^13.0.2"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
/* eslint-env mocha */
|
|
3
|
+
/* eslint no-proto: 0 */
|
|
4
|
+
var assert = require('assert')
|
|
5
|
+
var setPrototypeOf = require('..')
|
|
6
|
+
|
|
7
|
+
describe('setProtoOf(obj, proto)', function () {
|
|
8
|
+
it('should merge objects', function () {
|
|
9
|
+
var obj = { a: 1, b: 2 }
|
|
10
|
+
var proto = { b: 3, c: 4 }
|
|
11
|
+
var mergeObj = setPrototypeOf(obj, proto)
|
|
12
|
+
|
|
13
|
+
if (Object.getPrototypeOf) {
|
|
14
|
+
assert.strictEqual(Object.getPrototypeOf(obj), proto)
|
|
15
|
+
} else if ({ __proto__: [] } instanceof Array) {
|
|
16
|
+
assert.strictEqual(obj.__proto__, proto)
|
|
17
|
+
} else {
|
|
18
|
+
assert.strictEqual(obj.a, 1)
|
|
19
|
+
assert.strictEqual(obj.b, 2)
|
|
20
|
+
assert.strictEqual(obj.c, 4)
|
|
21
|
+
}
|
|
22
|
+
assert.strictEqual(mergeObj, obj)
|
|
23
|
+
})
|
|
24
|
+
})
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
2.0.1 / 2021-01-03
|
|
2
|
+
==================
|
|
3
|
+
|
|
4
|
+
* Fix returning values from `Object.prototype`
|
|
5
|
+
|
|
6
|
+
2.0.0 / 2020-04-19
|
|
7
|
+
==================
|
|
8
|
+
|
|
9
|
+
* Drop support for Node.js 0.6
|
|
10
|
+
* Fix messaging casing of `418 I'm a Teapot`
|
|
11
|
+
* Remove code 306
|
|
12
|
+
* Remove `status[code]` exports; use `status.message[code]`
|
|
13
|
+
* Remove `status[msg]` exports; use `status.code[msg]`
|
|
14
|
+
* Rename `425 Unordered Collection` to standard `425 Too Early`
|
|
15
|
+
* Rename `STATUS_CODES` export to `message`
|
|
16
|
+
* Return status message for `statuses(code)` when given code
|
|
17
|
+
|
|
18
|
+
1.5.0 / 2018-03-27
|
|
19
|
+
==================
|
|
20
|
+
|
|
21
|
+
* Add `103 Early Hints`
|
|
22
|
+
|
|
23
|
+
1.4.0 / 2017-10-20
|
|
24
|
+
==================
|
|
25
|
+
|
|
26
|
+
* Add `STATUS_CODES` export
|
|
27
|
+
|
|
28
|
+
1.3.1 / 2016-11-11
|
|
29
|
+
==================
|
|
30
|
+
|
|
31
|
+
* Fix return type in JSDoc
|
|
32
|
+
|
|
33
|
+
1.3.0 / 2016-05-17
|
|
34
|
+
==================
|
|
35
|
+
|
|
36
|
+
* Add `421 Misdirected Request`
|
|
37
|
+
* perf: enable strict mode
|
|
38
|
+
|
|
39
|
+
1.2.1 / 2015-02-01
|
|
40
|
+
==================
|
|
41
|
+
|
|
42
|
+
* Fix message for status 451
|
|
43
|
+
- `451 Unavailable For Legal Reasons`
|
|
44
|
+
|
|
45
|
+
1.2.0 / 2014-09-28
|
|
46
|
+
==================
|
|
47
|
+
|
|
48
|
+
* Add `208 Already Repored`
|
|
49
|
+
* Add `226 IM Used`
|
|
50
|
+
* Add `306 (Unused)`
|
|
51
|
+
* Add `415 Unable For Legal Reasons`
|
|
52
|
+
* Add `508 Loop Detected`
|
|
53
|
+
|
|
54
|
+
1.1.1 / 2014-09-24
|
|
55
|
+
==================
|
|
56
|
+
|
|
57
|
+
* Add missing 308 to `codes.json`
|
|
58
|
+
|
|
59
|
+
1.1.0 / 2014-09-21
|
|
60
|
+
==================
|
|
61
|
+
|
|
62
|
+
* Add `codes.json` for universal support
|
|
63
|
+
|
|
64
|
+
1.0.4 / 2014-08-20
|
|
65
|
+
==================
|
|
66
|
+
|
|
67
|
+
* Package cleanup
|
|
68
|
+
|
|
69
|
+
1.0.3 / 2014-06-08
|
|
70
|
+
==================
|
|
71
|
+
|
|
72
|
+
* Add 308 to `.redirect` category
|
|
73
|
+
|
|
74
|
+
1.0.2 / 2014-03-13
|
|
75
|
+
==================
|
|
76
|
+
|
|
77
|
+
* Add `.retry` category
|
|
78
|
+
|
|
79
|
+
1.0.1 / 2014-03-12
|
|
80
|
+
==================
|
|
81
|
+
|
|
82
|
+
* Initial release
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
|
5
|
+
Copyright (c) 2016 Douglas Christopher Wilson <doug@somethingdoug.com>
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|