mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-25 05:52:02 +02:00
Initial commit
This commit is contained in:
4
node_modules/camelize/.travis.yml
generated
vendored
Normal file
4
node_modules/camelize/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
18
node_modules/camelize/LICENSE
generated
vendored
Normal file
18
node_modules/camelize/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
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.
|
10
node_modules/camelize/example/camel.js
generated
vendored
Normal file
10
node_modules/camelize/example/camel.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
var camelize = require('../');
|
||||
var obj = {
|
||||
fee_fie_foe: 'fum',
|
||||
beep_boop: [
|
||||
{ 'abc.xyz': 'mno' },
|
||||
{ 'foo-bar': 'baz' }
|
||||
]
|
||||
};
|
||||
var res = camelize(obj);
|
||||
console.log(JSON.stringify(res, null, 2));
|
59
node_modules/camelize/index.js
generated
vendored
Normal file
59
node_modules/camelize/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
module.exports = function(obj) {
|
||||
if (typeof obj === 'string') return camelCase(obj);
|
||||
return walk(obj);
|
||||
};
|
||||
|
||||
function walk (obj) {
|
||||
if (!obj || typeof obj !== 'object') return obj;
|
||||
if (isDate(obj) || isRegex(obj)) return obj;
|
||||
if (isArray(obj)) return map(obj, walk);
|
||||
return reduce(objectKeys(obj), function (acc, key) {
|
||||
var camel = camelCase(key);
|
||||
acc[camel] = walk(obj[key]);
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function camelCase(str) {
|
||||
return str.replace(/[_.-](\w|$)/g, function (_,x) {
|
||||
return x.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
var isArray = Array.isArray || function (obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object Array]';
|
||||
};
|
||||
|
||||
var isDate = function (obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object Date]';
|
||||
};
|
||||
|
||||
var isRegex = function (obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
||||
};
|
||||
|
||||
var has = Object.prototype.hasOwnProperty;
|
||||
var objectKeys = Object.keys || function (obj) {
|
||||
var keys = [];
|
||||
for (var key in obj) {
|
||||
if (has.call(obj, key)) keys.push(key);
|
||||
}
|
||||
return keys;
|
||||
};
|
||||
|
||||
function map (xs, f) {
|
||||
if (xs.map) return xs.map(f);
|
||||
var res = [];
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
res.push(f(xs[i], i));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
function reduce (xs, f, acc) {
|
||||
if (xs.reduce) return xs.reduce(f, acc);
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
acc = f(acc, xs[i], i);
|
||||
}
|
||||
return acc;
|
||||
}
|
80
node_modules/camelize/package.json
generated
vendored
Normal file
80
node_modules/camelize/package.json
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"_from": "camelize@1.0.0",
|
||||
"_id": "camelize@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=",
|
||||
"_location": "/camelize",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "camelize@1.0.0",
|
||||
"name": "camelize",
|
||||
"escapedName": "camelize",
|
||||
"rawSpec": "1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/helmet-csp"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz",
|
||||
"_shasum": "164a5483e630fa4321e5af07020e531831b2609b",
|
||||
"_spec": "camelize@1.0.0",
|
||||
"_where": "/home/runner/Socketio-Chat-Template/node_modules/helmet-csp",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/substack/camelize/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "recursively transform key strings to camel-case",
|
||||
"devDependencies": {
|
||||
"tape": "~2.3.2"
|
||||
},
|
||||
"homepage": "https://github.com/substack/camelize",
|
||||
"keywords": [
|
||||
"camel-case",
|
||||
"json",
|
||||
"transform"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "camelize",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/substack/camelize.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": {
|
||||
"iexplore": [
|
||||
"6.0",
|
||||
"7.0",
|
||||
"8.0",
|
||||
"9.0"
|
||||
],
|
||||
"chrome": [
|
||||
"20.0"
|
||||
],
|
||||
"firefox": [
|
||||
"10.0",
|
||||
"15.0"
|
||||
],
|
||||
"safari": [
|
||||
"5.1"
|
||||
],
|
||||
"opera": [
|
||||
"12.0"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
62
node_modules/camelize/readme.markdown
generated
vendored
Normal file
62
node_modules/camelize/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# camelize
|
||||
|
||||
recursively transform key strings to camel-case
|
||||
|
||||
[](http://travis-ci.org/substack/camelize)
|
||||
|
||||
[](http://ci.testling.com/substack/camelize)
|
||||
|
||||
# example
|
||||
|
||||
``` js
|
||||
var camelize = require('camelize');
|
||||
var obj = {
|
||||
fee_fie_foe: 'fum',
|
||||
beep_boop: [
|
||||
{ 'abc.xyz': 'mno' },
|
||||
{ 'foo-bar': 'baz' }
|
||||
]
|
||||
};
|
||||
var res = camelize(obj);
|
||||
console.log(JSON.stringify(res, null, 2));
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
```
|
||||
{
|
||||
"feeFieFoe": "fum",
|
||||
"beepBoop": [
|
||||
{
|
||||
"abcXyz": "mno"
|
||||
},
|
||||
{
|
||||
"fooBar": "baz"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var camelize = require('camelize')
|
||||
```
|
||||
|
||||
## camelize(obj)
|
||||
|
||||
Convert the key strings in `obj` to camel-case recursively.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install camelize
|
||||
```
|
||||
|
||||
To use in the browser, use [browserify](http://browserify.org).
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
46
node_modules/camelize/test/camel.js
generated
vendored
Normal file
46
node_modules/camelize/test/camel.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
var test = require('tape');
|
||||
var camelize = require('../');
|
||||
|
||||
var obj = {
|
||||
fee_fie_foe: 'fum',
|
||||
beep_boop: [
|
||||
{ 'abc.xyz': 'mno' },
|
||||
{ 'foo-bar': 'baz' }
|
||||
]
|
||||
};
|
||||
|
||||
test('camelize a nested object', function (t) {
|
||||
t.plan(1);
|
||||
var res = camelize(obj);
|
||||
t.deepEqual(res, {
|
||||
"feeFieFoe": "fum",
|
||||
"beepBoop": [
|
||||
{ "abcXyz": "mno" },
|
||||
{ "fooBar": "baz" }
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
test('string', function (t) {
|
||||
t.plan(1);
|
||||
t.equal(camelize('one_two'), 'oneTwo');
|
||||
});
|
||||
|
||||
test('date', function (t) {
|
||||
t.plan(1);
|
||||
var d = new Date();
|
||||
t.equal(camelize(d), d);
|
||||
});
|
||||
|
||||
test('regex', function (t) {
|
||||
t.plan(1);
|
||||
var r = /1234/;
|
||||
t.equal(camelize(r), r);
|
||||
});
|
||||
|
||||
test('only camelize strings that are the root value', function (t) {
|
||||
t.plan(2);
|
||||
t.equal(camelize('foo-bar'), 'fooBar');
|
||||
var res = camelize({ 'foo-bar': 'baz-foo' });
|
||||
t.deepEqual(res, { fooBar: 'baz-foo' });
|
||||
});
|
Reference in New Issue
Block a user