1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-13 19:12:49 +00:00

updated bunch of file paths and changed the way posts are loaded

This commit is contained in:
2016-01-05 12:28:04 -06:00
parent 4bb8cae81e
commit 6ab45fe935
13249 changed files with 317868 additions and 2101398 deletions

View File

@@ -0,0 +1,51 @@
2.1.0 / 2015-05-21
==================
* add `.format` export
* add `.parse` export
2.0.2 / 2015-05-20
==================
* remove map recreation
* remove unnecessary object construction
2.0.1 / 2015-05-07
==================
* fix browserify require
* remove node.extend dependency
2.0.0 / 2015-04-12
==================
* add option "case"
* add option "thousandsSeparator"
* return "null" on invalid parse input
* support proper round-trip: bytes(bytes(num)) === num
* units no longer case sensitive when parsing
1.0.0 / 2014-05-05
==================
* add negative support. fixes #6
0.3.0 / 2014-03-19
==================
* added terabyte support
0.2.1 / 2013-04-01
==================
* add .component
0.2.0 / 2012-10-28
==================
* bytes(200).should.eql('200b')
0.1.0 / 2012-07-04
==================
* add bytes to string conversion [yields]

View File

@@ -0,0 +1,83 @@
# Bytes utility
Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
## Usage
```js
var bytes = require('bytes');
```
#### bytes.format(number value, [options]): string|null
Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is
rounded.
**Arguments**
| Name | Type | Description |
|---------|--------|--------------------|
| value | `number` | Value in bytes |
| options | `Object` | Conversion options |
**Options**
| Property | Type | Description |
|-------------------|--------|-----------------------------------------------------------------------------------------|
| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `.`... Default value to `' '`. |
**Returns**
| Name | Type | Description |
|---------|-------------|-------------------------|
| results | `string`|`null` | Return null upon error. String value otherwise. |
**Example**
```js
bytes(1024);
// output: '1kB'
bytes(1000);
// output: '1000B'
bytes(1000, {thousandsSeparator: ' '});
// output: '1 000B'
```
#### bytes.parse(string value): number|null
Parse the string value into an integer in bytes. If no unit is given, it is assumed the value is in bytes.
**Arguments**
| Name | Type | Description |
|---------------|--------|--------------------|
| value | `string` | String to parse. |
**Returns**
| Name | Type | Description |
|---------|-------------|-------------------------|
| results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
**Example**
```js
bytes('1kB');
// output: 1024
bytes('1024');
// output: 1024
```
## Installation
```bash
npm install bytes --save
component install visionmedia/bytes.js
```
## License
[![npm](https://img.shields.io/npm/l/express.svg)](https://github.com/visionmedia/bytes.js/blob/master/LICENSE)

133
node_modules/mongo-express/node_modules/bytes/index.js generated vendored Normal file
View File

@@ -0,0 +1,133 @@
/*!
* bytes
* Copyright(c) 2012-2014 TJ Holowaychuk
* Copyright(c) 2015 Jed Watson
* MIT Licensed
*/
'use strict';
/**
* Module exports.
* @public
*/
module.exports = bytes;
module.exports.format = format;
module.exports.parse = parse;
/**
* Module variables.
* @private
*/
var map = {
b: 1,
kb: 1 << 10,
mb: 1 << 20,
gb: 1 << 30,
tb: ((1 << 30) * 1024)
};
/**
*Convert the given value in bytes into a string or parse to string to an integer in bytes.
*
* @param {string|number} value
* @param {{
* case: [string],
* thousandsSeparator: [string]
* }} [options] bytes options.
*
* @returns {string|number|null}
*/
function bytes(value, options) {
if (typeof value === 'string') {
return parse(value);
}
if (typeof value === 'number') {
return format(value, options);
}
return null;
}
/**
* Format the given value in bytes into a string.
*
* If the value is negative, it is kept as such. If it is a float,
* it is rounded.
*
* @param {number} value
* @param {object} [options]
* @param {string} [options.thousandsSeparator=]
* @public
*/
function format(val, options) {
if (typeof val !== 'number') {
return null;
}
var mag = Math.abs(val);
var thousandsSeparator = (options && options.thousandsSeparator) || '';
var unit = 'B';
var value = val;
if (mag >= map.tb) {
value = Math.round(value / map.tb * 100) / 100;
unit = 'TB';
} else if (mag >= map.gb) {
value = Math.round(value / map.gb * 100) / 100;
unit = 'GB';
} else if (mag >= map.mb) {
value = Math.round(value / map.mb * 100) / 100;
unit = 'MB';
} else if (mag >= map.kb) {
value = Math.round(value / map.kb * 100) / 100;
unit = 'kB';
}
if (thousandsSeparator) {
value = value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator);
}
return value + unit;
}
/**
* Parse the string value into an integer in bytes.
*
* If no unit is given, it is assumed the value is in bytes.
*
* @param {number|string} val
* @public
*/
function parse(val) {
if (typeof val === 'number' && !isNaN(val)) {
return val;
}
if (typeof val !== 'string') {
return null;
}
// Test if the string passed is valid
var results = val.match(/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb)$/i);
var floatValue;
var unit = 'b';
if (!results) {
// Nothing could be extracted from the given string
floatValue = parseInt(val);
unit = 'b'
} else {
// Retrieve the value and the unit
floatValue = parseFloat(results[1]);
unit = results[4].toLowerCase();
}
return map[unit] * floatValue;
}

View File

@@ -0,0 +1,103 @@
{
"_args": [
[
"bytes@2.1.0",
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/mongo-express/node_modules/body-parser"
]
],
"_from": "bytes@2.1.0",
"_id": "bytes@2.1.0",
"_inCache": true,
"_installable": true,
"_location": "/mongo-express/bytes",
"_npmUser": {
"email": "doug@somethingdoug.com",
"name": "dougwilson"
},
"_npmVersion": "1.4.28",
"_phantomChildren": {},
"_requested": {
"name": "bytes",
"raw": "bytes@2.1.0",
"rawSpec": "2.1.0",
"scope": null,
"spec": "2.1.0",
"type": "version"
},
"_requiredBy": [
"/mongo-express/body-parser"
],
"_resolved": "https://registry.npmjs.org/bytes/-/bytes-2.1.0.tgz",
"_shasum": "ac93c410e2ffc9cc7cf4b464b38289067f5e47b4",
"_shrinkwrap": null,
"_spec": "bytes@2.1.0",
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/mongo-express/node_modules/body-parser",
"author": {
"email": "tj@vision-media.ca",
"name": "TJ Holowaychuk",
"url": "http://tjholowaychuk.com"
},
"bugs": {
"url": "https://github.com/visionmedia/bytes.js/issues"
},
"component": {
"scripts": {
"bytes/index.js": "index.js"
}
},
"contributors": [
{
"name": "Jed Watson",
"email": "jed.watson@me.com"
}
],
"dependencies": {},
"description": "Utility to parse a string bytes to bytes and vice-versa",
"devDependencies": {
"mocha": "*"
},
"directories": {},
"dist": {
"shasum": "ac93c410e2ffc9cc7cf4b464b38289067f5e47b4",
"tarball": "http://registry.npmjs.org/bytes/-/bytes-2.1.0.tgz"
},
"files": [
"History.md",
"LICENSE",
"Readme.md",
"index.js"
],
"gitHead": "86e4520cc369b34866154a53344ca50b2bb5ddcd",
"homepage": "https://github.com/visionmedia/bytes.js",
"keywords": [
"byte",
"bytes",
"convert",
"converter",
"parse",
"parser",
"utility"
],
"license": "MIT",
"maintainers": [
{
"name": "tjholowaychuk",
"email": "tj@vision-media.ca"
},
{
"name": "dougwilson",
"email": "doug@somethingdoug.com"
}
],
"name": "bytes",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/visionmedia/bytes.js.git"
},
"scripts": {
"test": "mocha --check-leaks --reporter spec"
},
"version": "2.1.0"
}