modif comtabilite

This commit is contained in:
2019-01-16 16:23:31 +01:00
parent 6b741a9666
commit 9312edc3ae
1844 changed files with 158848 additions and 55874 deletions
+1
View File
@@ -36,6 +36,7 @@ Caseless.prototype.get = function (name) {
}
Caseless.prototype.swap = function (name) {
var has = this.has(name)
if (has === name) return
if (!has) throw new Error('There is no header than matches "'+name+'"')
this.dict[name] = this.dict[has]
delete this.dict[has]
+14 -18
View File
@@ -1,33 +1,27 @@
{
"_args": [
[
"caseless@0.11.0",
"/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah"
]
],
"_development": true,
"_from": "caseless@0.11.0",
"_id": "caseless@0.11.0",
"_from": "caseless@~0.12.0",
"_id": "caseless@0.12.0",
"_inBundle": false,
"_integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=",
"_integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"_location": "/caseless",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "caseless@0.11.0",
"raw": "caseless@~0.12.0",
"name": "caseless",
"escapedName": "caseless",
"rawSpec": "0.11.0",
"rawSpec": "~0.12.0",
"saveSpec": null,
"fetchSpec": "0.11.0"
"fetchSpec": "~0.12.0"
},
"_requiredBy": [
"/request"
],
"_resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz",
"_spec": "0.11.0",
"_where": "/mnt/data/Sites/anissabensalah.net/user/themes/anissabensalah",
"_resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"_shasum": "1b681c21ff84033c826543090689420d187151dc",
"_spec": "caseless@~0.12.0",
"_where": "/home/kevin/Documents/Sites/anissabensalah.net/user/themes/anissabensalah/node_modules/request",
"author": {
"name": "Mikeal Rogers",
"email": "mikeal.rogers@gmail.com"
@@ -35,6 +29,8 @@
"bugs": {
"url": "https://github.com/mikeal/caseless/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Caseless object set/get/has, very useful when working with HTTP headers.",
"devDependencies": {
"tape": "^2.10.2"
@@ -56,5 +52,5 @@
"test": "node test.js"
},
"test": "node test.js",
"version": "0.11.0"
"version": "0.12.0"
}
+27
View File
@@ -38,3 +38,30 @@ tape('set get has', function (t) {
t.equal(c.get('tva'), 'test1')
})
tape('swap', function (t) {
var headers = {}
, c = caseless(headers)
;
t.plan(4)
// No Header to Swap.
t.throws(function () {
c.swap('content-type')
})
// Set Header.
c.set('content-type', 'application/json')
// Swap Header With Itself.
c.swap('content-type')
// Does Not Delete Itself.
t.ok(c.has('content-type'))
// Swap Header With a Different Header.
c.swap('Content-Type')
// Still Has Header.
t.ok(c.has('Content-Type'))
// Delete Header.
c.del('Content-Type')
// No Header to Swap.
t.throws(function () {
c.swap('content-type')
})
})