aboutsummaryrefslogtreecommitdiff
path: root/node_modules/stringify-object
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
commitabd94a7f5a50f43c797a11b53549ae48fff667c3 (patch)
treeab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/stringify-object
parenta0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff)
downloadwallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz
add node_modules to address #4364
Diffstat (limited to 'node_modules/stringify-object')
-rw-r--r--node_modules/stringify-object/LICENSE22
-rw-r--r--node_modules/stringify-object/index.js113
-rw-r--r--node_modules/stringify-object/package.json125
-rw-r--r--node_modules/stringify-object/readme.md121
4 files changed, 381 insertions, 0 deletions
diff --git a/node_modules/stringify-object/LICENSE b/node_modules/stringify-object/LICENSE
new file mode 100644
index 000000000..ff642e65a
--- /dev/null
+++ b/node_modules/stringify-object/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2015, Yeoman team
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/stringify-object/index.js b/node_modules/stringify-object/index.js
new file mode 100644
index 000000000..502982de5
--- /dev/null
+++ b/node_modules/stringify-object/index.js
@@ -0,0 +1,113 @@
+'use strict';
+var isRegexp = require('is-regexp');
+var isPlainObj = require('is-plain-obj');
+
+module.exports = function (val, opts, pad) {
+ var seen = [];
+
+ return (function stringify(val, opts, pad) {
+ opts = opts || {};
+ opts.indent = opts.indent || '\t';
+ pad = pad || '';
+ var tokens;
+ if(opts.inlineCharacterLimit == void 0) {
+ tokens = {
+ newLine: '\n',
+ newLineOrSpace: '\n',
+ pad: pad,
+ indent: pad + opts.indent
+ };
+ } else {
+ tokens = {
+ newLine: '@@__STRINGIFY_OBJECT_NEW_LINE__@@',
+ newLineOrSpace: '@@__STRINGIFY_OBJECT_NEW_LINE_OR_SPACE__@@',
+ pad: '@@__STRINGIFY_OBJECT_PAD__@@',
+ indent: '@@__STRINGIFY_OBJECT_INDENT__@@'
+ }
+ }
+ var expandWhiteSpace = function(string) {
+ if (opts.inlineCharacterLimit == void 0) { return string; }
+ var oneLined = string.
+ replace(new RegExp(tokens.newLine, 'g'), '').
+ replace(new RegExp(tokens.newLineOrSpace, 'g'), ' ').
+ replace(new RegExp(tokens.pad + '|' + tokens.indent, 'g'), '');
+
+ if(oneLined.length <= opts.inlineCharacterLimit) {
+ return oneLined;
+ } else {
+ return string.
+ replace(new RegExp(tokens.newLine + '|' + tokens.newLineOrSpace, 'g'), '\n').
+ replace(new RegExp(tokens.pad, 'g'), pad).
+ replace(new RegExp(tokens.indent, 'g'), pad + opts.indent);
+ }
+ };
+
+ if (seen.indexOf(val) !== -1) {
+ return '"[Circular]"';
+ }
+
+ if (val === null ||
+ val === undefined ||
+ typeof val === 'number' ||
+ typeof val === 'boolean' ||
+ typeof val === 'function' ||
+ isRegexp(val)) {
+ return String(val);
+ }
+
+ if (val instanceof Date) {
+ return 'new Date(\'' + val.toISOString() + '\')';
+ }
+
+ if (Array.isArray(val)) {
+ if (val.length === 0) {
+ return '[]';
+ }
+
+ seen.push(val);
+
+ var ret = '[' + tokens.newLine + val.map(function (el, i) {
+ var eol = val.length - 1 === i ? tokens.newLine : ',' + tokens.newLineOrSpace;
+ return tokens.indent + stringify(el, opts, pad + opts.indent) + eol;
+ }).join('') + tokens.pad + ']';
+
+ seen.pop(val);
+
+ return expandWhiteSpace(ret);
+ }
+
+ if (isPlainObj(val)) {
+ var objKeys = Object.keys(val);
+
+ if (objKeys.length === 0) {
+ return '{}';
+ }
+
+ seen.push(val);
+
+ var ret = '{' + tokens.newLine + objKeys.map(function (el, i) {
+ if (opts.filter && !opts.filter(val, el)) {
+ return '';
+ }
+
+ var eol = objKeys.length - 1 === i ? tokens.newLine : ',' + tokens.newLineOrSpace;
+ var key = /^[a-z$_][a-z$_0-9]*$/i.test(el) ? el : stringify(el, opts);
+ return tokens.indent + key + ': ' + stringify(val[el], opts, pad + opts.indent) + eol;
+ }).join('') + tokens.pad + '}';
+
+ seen.pop(val);
+
+ return expandWhiteSpace(ret);
+ }
+
+ val = String(val).replace(/[\r\n]/g, function (x) {
+ return x === '\n' ? '\\n' : '\\r';
+ });
+
+ if (opts.singleQuotes === false) {
+ return '"' + val.replace(/"/g, '\\\"') + '"';
+ }
+
+ return '\'' + val.replace(/'/g, '\\\'') + '\'';
+ })(val, opts, pad);
+};
diff --git a/node_modules/stringify-object/package.json b/node_modules/stringify-object/package.json
new file mode 100644
index 000000000..2766b7413
--- /dev/null
+++ b/node_modules/stringify-object/package.json
@@ -0,0 +1,125 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "stringify-object@^2.3.0",
+ "scope": null,
+ "escapedName": "stringify-object",
+ "name": "stringify-object",
+ "rawSpec": "^2.3.0",
+ "spec": ">=2.3.0 <3.0.0",
+ "type": "range"
+ },
+ "/home/dold/repos/taler/wallet-webex/node_modules/gulp-debug"
+ ]
+ ],
+ "_from": "stringify-object@>=2.3.0 <3.0.0",
+ "_id": "stringify-object@2.4.0",
+ "_inCache": true,
+ "_location": "/stringify-object",
+ "_nodeVersion": "5.11.1",
+ "_npmOperationalInternal": {
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/stringify-object-2.4.0.tgz_1465857986799_0.9020727449096739"
+ },
+ "_npmUser": {
+ "name": "sboudrias",
+ "email": "admin@simonboudrias.com"
+ },
+ "_npmVersion": "3.5.3",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "stringify-object@^2.3.0",
+ "scope": null,
+ "escapedName": "stringify-object",
+ "name": "stringify-object",
+ "rawSpec": "^2.3.0",
+ "spec": ">=2.3.0 <3.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/gulp-debug"
+ ],
+ "_resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-2.4.0.tgz",
+ "_shasum": "c62d11023eb21fe2d9b087be039a26df3b22a09d",
+ "_shrinkwrap": null,
+ "_spec": "stringify-object@^2.3.0",
+ "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp-debug",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/yeoman/stringify-object/issues"
+ },
+ "dependencies": {
+ "is-plain-obj": "^1.0.0",
+ "is-regexp": "^1.0.0"
+ },
+ "description": "Stringify an object/array like JSON.stringify just without all the double-quotes",
+ "devDependencies": {
+ "mocha": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "c62d11023eb21fe2d9b087be039a26df3b22a09d",
+ "tarball": "https://registry.npmjs.org/stringify-object/-/stringify-object-2.4.0.tgz"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "files": [
+ "index.js"
+ ],
+ "gitHead": "5869b0de4ce0f839d30a5194537c3abd57805a03",
+ "homepage": "https://github.com/yeoman/stringify-object#readme",
+ "keywords": [
+ "object",
+ "stringify",
+ "pretty",
+ "print",
+ "dump",
+ "format",
+ "type",
+ "json"
+ ],
+ "license": "BSD-2-Clause",
+ "maintainers": [
+ {
+ "name": "sindresorhus",
+ "email": "sindresorhus@gmail.com"
+ },
+ {
+ "name": "addyosmani",
+ "email": "addyosmani@gmail.com"
+ },
+ {
+ "name": "passy",
+ "email": "phartig@rdrei.net"
+ },
+ {
+ "name": "sboudrias",
+ "email": "admin@simonboudrias.com"
+ },
+ {
+ "name": "eddiemonge",
+ "email": "eddie+npm@eddiemonge.com"
+ },
+ {
+ "name": "arthurvr",
+ "email": "contact@arthurverschaeve.be"
+ }
+ ],
+ "name": "stringify-object",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/yeoman/stringify-object.git"
+ },
+ "scripts": {
+ "test": "mocha"
+ },
+ "version": "2.4.0"
+}
diff --git a/node_modules/stringify-object/readme.md b/node_modules/stringify-object/readme.md
new file mode 100644
index 000000000..57c5bae9e
--- /dev/null
+++ b/node_modules/stringify-object/readme.md
@@ -0,0 +1,121 @@
+# stringify-object [![Build Status](https://secure.travis-ci.org/yeoman/stringify-object.svg?branch=master)](http://travis-ci.org/yeoman/stringify-object)
+
+> Stringify an object/array like JSON.stringify just without all the double-quotes.
+
+Useful for when you want to get the string representation of an object in a formatted way.
+
+It also handles circular references and lets you specify quote type.
+
+
+## Install
+
+```
+$ npm install --save stringify-object
+```
+
+
+## Usage
+
+```js
+var obj = {
+ foo: 'bar',
+ 'arr': [1, 2, 3],
+ nested: { hello: "world" }
+};
+
+var pretty = stringifyObject(obj, {
+ indent: ' ',
+ singleQuotes: false
+});
+
+console.log(pretty);
+/*
+{
+ foo: "bar",
+ arr: [
+ 1,
+ 2,
+ 3
+ ],
+ nested: {
+ hello: "world"
+ }
+}
+*/
+```
+
+
+## API
+
+### stringifyObject(input, [options])
+
+Circular references will be replaced with `"[Circular]"`.
+
+#### input
+
+*Required*
+Type: `object`, `array`
+
+#### options
+
+##### indent
+
+Type: `string`
+Default: `'\t'`
+
+Choose the indentation you prefer.
+
+##### singleQuotes
+
+Type: `boolean`
+Default: `true`
+
+Set to false to get double-quoted strings.
+
+##### filter(obj, prop)
+
+Type: `function`
+
+Expected to return a boolean of whether to keep the object.
+
+##### inlineCharacterLimit
+
+Type: `number`
+Default: undefined
+
+When set, will inline values up to `inlineCharacterLimit` length for the sake
+of more terse output.
+
+For example, given the example at the top of the README:
+
+```js
+var obj = {
+ foo: 'bar',
+ 'arr': [1, 2, 3],
+ nested: { hello: "world" }
+};
+
+var pretty = stringifyObject(obj, {
+ indent: ' ',
+ singleQuotes: false,
+ inlineCharacterLimit: 12
+});
+
+console.log(pretty);
+/*
+{
+ foo: "bar",
+ arr: [1, 2, 3],
+ nested: {
+ hello: "world"
+ }
+}
+*/
+```
+
+As you can see, `arr` was printed as a one-liner because its string was shorter
+than 12 characters.
+
+## License
+
+[BSD license](http://opensource.org/licenses/bsd-license.php) © Yeoman Team