Izmjenjena struktura, dodan backand

This commit is contained in:
GotPPay
2017-10-16 11:19:46 +02:00
parent 1ec88afacb
commit 048e32c4aa
37153 changed files with 2975854 additions and 1 deletions

View File

@@ -0,0 +1,55 @@
'use strict';var _assign = require('babel-runtime/core-js/object/assign');var _assign2 = _interopRequireDefault(_assign);var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);var _inherits2 = require('babel-runtime/helpers/inherits');var _inherits3 = _interopRequireDefault(_inherits2);var _for = require('babel-runtime/core-js/symbol/for');var _for2 = _interopRequireDefault(_for);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var asymmetricMatcher = (0, _for2.default)('jest.asymmetricMatcher'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var SPACE = ' ';var ArrayContaining = function (_Array) {(0, _inherits3.default)(ArrayContaining, _Array);function ArrayContaining() {(0, _classCallCheck3.default)(this, ArrayContaining);return (0, _possibleConstructorReturn3.default)(this, (ArrayContaining.__proto__ || (0, _getPrototypeOf2.default)(ArrayContaining)).apply(this, arguments));}return ArrayContaining;}(Array);var ObjectContaining = function (_Object) {(0, _inherits3.default)(ObjectContaining, _Object);function ObjectContaining() {(0, _classCallCheck3.default)(this, ObjectContaining);return (0, _possibleConstructorReturn3.default)(this, (ObjectContaining.__proto__ || (0, _getPrototypeOf2.default)(ObjectContaining)).apply(this, arguments));}return ObjectContaining;}(Object);var print = function print(val, _print,
indent,
opts,
colors)
{
var stringedValue = val.toString();
if (stringedValue === 'ArrayContaining') {
var array = ArrayContaining.from(val.sample);
return opts.spacing === SPACE ?
stringedValue + SPACE + _print(array) :
_print(array);
}
if (stringedValue === 'ObjectContaining') {
var object = (0, _assign2.default)(new ObjectContaining(), val.sample);
return opts.spacing === SPACE ?
stringedValue + SPACE + _print(object) :
_print(object);
}
if (stringedValue === 'StringMatching') {
return stringedValue + SPACE + _print(val.sample);
}
if (stringedValue === 'StringContaining') {
return stringedValue + SPACE + _print(val.sample);
}
return val.toAsymmetricMatcher();
};
var test = function test(object) {return object && object.$$typeof === asymmetricMatcher;};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,49 @@
'use strict';
var ansiRegex = require('ansi-regex'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var toHumanReadableAnsi = function toHumanReadableAnsi(text) {var style = require('ansi-styles');return text.replace(ansiRegex(), function (match, offset, string) {switch (match) {case style.red.close:case style.green.close:case style.reset.open:
case style.reset.close:
return '</>';
case style.red.open:
return '<red>';
case style.green.open:
return '<green>';
case style.dim.open:
return '<dim>';
case style.bold.open:
return '<bold>';
default:
return '';}
});
};
var test = function test(value) {return (
typeof value === 'string' && value.match(ansiRegex()));};
var print = function print(
val,
_print,
indent,
opts,
colors) {return (
_print(toHumanReadableAnsi(val)));};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,143 @@
'use strict';var _typeof2 = require('babel-runtime/helpers/typeof');var _typeof3 = _interopRequireDefault(_typeof2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var escapeHTML = require('./lib/escapeHTML'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
var HTML_ELEMENT_REGEXP = /(HTML\w*?Element)|Text|Comment/;
var test = isHTMLElement;
function isHTMLElement(value) {
return (
value !== undefined &&
value !== null && (
value.nodeType === 1 || value.nodeType === 3 || value.nodeType === 8) &&
value.constructor !== undefined &&
value.constructor.name !== undefined &&
HTML_ELEMENT_REGEXP.test(value.constructor.name));
}
function printChildren(flatChildren, print, indent, colors, opts) {
return flatChildren.
map(function (node) {
if ((typeof node === 'undefined' ? 'undefined' : (0, _typeof3.default)(node)) === 'object') {
return print(node, print, indent, colors, opts);
} else if (typeof node === 'string') {
return colors.content.open + escapeHTML(node) + colors.content.close;
} else {
return print(node);
}
}).
filter(function (value) {return value.trim().length;}).
join(opts.edgeSpacing);
}
function printAttributes(attributes, indent, colors, opts) {
return attributes.
sort().
map(function (attribute) {
return (
opts.spacing +
indent(colors.prop.open + attribute.name + colors.prop.close + '=') +
colors.value.open + ('"' +
attribute.value + '"') +
colors.value.close);
}).
join('');
}
var print = function print(
element,
_print,
indent,
opts,
colors)
{
if (element.nodeType === 3) {
return element.data.
split('\n').
map(function (text) {return text.trimLeft();}).
filter(function (text) {return text.length;}).
join(' ');
} else if (element.nodeType === 8) {
return (
colors.comment.open +
'<!-- ' +
element.data.trim() +
' -->' +
colors.comment.close);
}
var result = colors.tag.open + '<';
var elementName = element.tagName.toLowerCase();
result += elementName + colors.tag.close;
var hasAttributes = element.attributes && element.attributes.length;
if (hasAttributes) {
var _attributes = Array.prototype.slice.call(element.attributes);
result += printAttributes(_attributes, indent, colors, opts);
}
var flatChildren = Array.prototype.slice.call(element.childNodes);
if (!flatChildren.length && element.textContent) {
flatChildren.push(element.textContent);
}
var closeInNewLine = hasAttributes && !opts.min;
if (flatChildren.length) {
var children = printChildren(flatChildren, _print, indent, colors, opts);
result +=
colors.tag.open + (
closeInNewLine ? '\n' : '') +
'>' +
colors.tag.close +
opts.edgeSpacing +
indent(children) +
opts.edgeSpacing +
colors.tag.open +
'</' +
elementName +
'>' +
colors.tag.close;
} else {
result +=
colors.tag.open + (closeInNewLine ? '\n' : ' ') + '/>' + colors.tag.close;
}
return result;
};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,26 @@
'use strict';
var printImmutable = require('./lib/printImmutable'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var IS_LIST = '@@__IMMUTABLE_LIST__@@';var test = function test(maybeList) {return !!(maybeList && maybeList[IS_LIST]);};var print = function print(val, _print, indent,
opts,
colors) {return (
printImmutable(val, _print, indent, opts, colors, 'List', false));};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,28 @@
'use strict';
var printImmutable = require('./lib/printImmutable'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var IS_MAP = '@@__IMMUTABLE_MAP__@@';var IS_ORDERED = '@@__IMMUTABLE_ORDERED__@@';var test = function test(maybeMap) {return !!(maybeMap && maybeMap[IS_MAP] && !maybeMap[IS_ORDERED]);};var print = function print(val,
_print,
indent,
opts,
colors) {return (
printImmutable(val, _print, indent, opts, colors, 'Map', true));};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,28 @@
'use strict';
var printImmutable = require('./lib/printImmutable'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var IS_MAP = '@@__IMMUTABLE_MAP__@@';var IS_ORDERED = '@@__IMMUTABLE_ORDERED__@@';var test = function test(maybeOrderedMap) {return maybeOrderedMap && maybeOrderedMap[IS_MAP] && maybeOrderedMap[IS_ORDERED];};var print = function print(val,
_print,
indent,
opts,
colors) {return (
printImmutable(val, _print, indent, opts, colors, 'OrderedMap', true));};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,28 @@
'use strict';
var printImmutable = require('./lib/printImmutable'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var IS_SET = '@@__IMMUTABLE_SET__@@';var IS_ORDERED = '@@__IMMUTABLE_ORDERED__@@';var test = function test(maybeOrderedSet) {return maybeOrderedSet && maybeOrderedSet[IS_SET] && maybeOrderedSet[IS_ORDERED];};var print = function print(val,
_print,
indent,
opts,
colors) {return (
printImmutable(val, _print, indent, opts, colors, 'OrderedSet', false));};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,17 @@
'use strict'; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
module.exports = [
require('./ImmutableList'),
require('./ImmutableSet'),
require('./ImmutableMap'),
require('./ImmutableStack'),
require('./ImmutableOrderedSet'),
require('./ImmutableOrderedMap')];

View File

@@ -0,0 +1,28 @@
'use strict';
var printImmutable = require('./lib/printImmutable'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var IS_SET = '@@__IMMUTABLE_SET__@@';var IS_ORDERED = '@@__IMMUTABLE_ORDERED__@@';var test = function test(maybeSet) {return !!(maybeSet && maybeSet[IS_SET] && !maybeSet[IS_ORDERED]);};var print = function print(val,
_print,
indent,
opts,
colors) {return (
printImmutable(val, _print, indent, opts, colors, 'Set', false));};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,26 @@
'use strict';
var printImmutable = require('./lib/printImmutable'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var IS_STACK = '@@__IMMUTABLE_STACK__@@';var test = function test(maybeStack) {return !!(maybeStack && maybeStack[IS_STACK]);};var print = function print(val, _print, indent,
opts,
colors) {return (
printImmutable(val, _print, indent, opts, colors, 'Stack', false));};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,126 @@
'use strict';var _keys = require('babel-runtime/core-js/object/keys');var _keys2 = _interopRequireDefault(_keys);var _typeof2 = require('babel-runtime/helpers/typeof');var _typeof3 = _interopRequireDefault(_typeof2);var _for = require('babel-runtime/core-js/symbol/for');var _for2 = _interopRequireDefault(_for);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var escapeHTML = require('./lib/escapeHTML'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var reactElement = (0, _for2.default)('react.element');function traverseChildren(opaqueChildren, cb) {if (Array.isArray(opaqueChildren)) {opaqueChildren.forEach(function (child) {return traverseChildren(child, cb);});} else if (opaqueChildren != null && opaqueChildren !== false) {cb(opaqueChildren);
}
}
function printChildren(flatChildren, print, indent, colors, opts) {
return flatChildren.
map(function (node) {
if ((typeof node === 'undefined' ? 'undefined' : (0, _typeof3.default)(node)) === 'object') {
return print(node, print, indent, colors, opts);
} else if (typeof node === 'string') {
return colors.content.open + escapeHTML(node) + colors.content.close;
} else {
return print(node);
}
}).
join(opts.edgeSpacing);
}
function printProps(props, print, indent, colors, opts) {
return (0, _keys2.default)(props).
sort().
map(function (name) {
if (name === 'children') {
return '';
}
var prop = props[name];
var printed = print(prop);
if (typeof prop !== 'string') {
if (printed.indexOf('\n') !== -1) {
printed =
'{' +
opts.edgeSpacing +
indent(indent(printed) + opts.edgeSpacing + '}');
} else {
printed = '{' + printed + '}';
}
}
return (
opts.spacing +
indent(colors.prop.open + name + colors.prop.close + '=') +
colors.value.open +
printed +
colors.value.close);
}).
join('');
}
var print = function print(
element,
_print,
indent,
opts,
colors)
{
var result = colors.tag.open + '<';
var elementName = void 0;
if (typeof element.type === 'string') {
elementName = element.type;
} else if (typeof element.type === 'function') {
elementName = element.type.displayName || element.type.name || 'Unknown';
} else {
elementName = 'Unknown';
}
result += elementName + colors.tag.close;
result += printProps(element.props, _print, indent, colors, opts);
var opaqueChildren = element.props.children;
var hasProps = !!(0, _keys2.default)(element.props).filter(
function (propName) {return propName !== 'children';}).
length;
var closeInNewLine = hasProps && !opts.min;
if (opaqueChildren) {
var flatChildren = [];
traverseChildren(opaqueChildren, function (child) {
flatChildren.push(child);
});
var children = printChildren(flatChildren, _print, indent, colors, opts);
result +=
colors.tag.open + (
closeInNewLine ? '\n' : '') +
'>' +
colors.tag.close +
opts.edgeSpacing +
indent(children) +
opts.edgeSpacing +
colors.tag.open +
'</' +
elementName +
'>' +
colors.tag.close;
} else {
result +=
colors.tag.open + (closeInNewLine ? '\n' : ' ') + '/>' + colors.tag.close;
}
return result;
};
var test = function test(object) {return object && object.$$typeof === reactElement;};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,121 @@
'use strict';var _keys = require('babel-runtime/core-js/object/keys');var _keys2 = _interopRequireDefault(_keys);var _for = require('babel-runtime/core-js/symbol/for');var _for2 = _interopRequireDefault(_for);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var escapeHTML = require('./lib/escapeHTML'); /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var reactTestInstance = (0, _for2.default)('react.test.json');function printChildren(children, print, indent, colors,
opts)
{
return children.
map(function (child) {return printInstance(child, print, indent, colors, opts);}).
join(opts.edgeSpacing);
}
function printProps(props, print, indent, colors, opts) {
return (0, _keys2.default)(props).
sort().
map(function (name) {
var prop = props[name];
var printed = print(prop);
if (typeof prop !== 'string') {
if (printed.indexOf('\n') !== -1) {
printed =
'{' +
opts.edgeSpacing +
indent(indent(printed) + opts.edgeSpacing + '}');
} else {
printed = '{' + printed + '}';
}
}
return (
opts.spacing +
indent(colors.prop.open + name + colors.prop.close + '=') +
colors.value.open +
printed +
colors.value.close);
}).
join('');
}
function printInstance(instance, print, indent, colors, opts) {
if (typeof instance == 'number') {
return print(instance);
} else if (typeof instance === 'string') {
return colors.content.open + escapeHTML(instance) + colors.content.close;
}
var closeInNewLine = false;
var result = colors.tag.open + '<' + instance.type + colors.tag.close;
if (instance.props) {
closeInNewLine = !!(0, _keys2.default)(instance.props).length && !opts.min;
result += printProps(instance.props, print, indent, colors, opts);
}
if (instance.children) {
var children = printChildren(
instance.children,
print,
indent,
colors,
opts);
result +=
colors.tag.open + (
closeInNewLine ? '\n' : '') +
'>' +
colors.tag.close +
opts.edgeSpacing +
indent(children) +
opts.edgeSpacing +
colors.tag.open +
'</' +
instance.type +
'>' +
colors.tag.close;
} else {
result +=
colors.tag.open + (closeInNewLine ? '\n' : ' ') + '/>' + colors.tag.close;
}
return result;
}
var print = function print(
val,
_print,
indent,
opts,
colors) {return (
printInstance(val, _print, indent, colors, opts));};
var test = function test(object) {return (
object && object.$$typeof === reactTestInstance);};
module.exports = { print: print, test: test };

View File

@@ -0,0 +1,15 @@
'use strict'; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
function escapeHTML(str) {
return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
module.exports = escapeHTML;

View File

@@ -0,0 +1,57 @@
'use strict';var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var IMMUTABLE_NAMESPACE = 'Immutable.'; /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/var SPACE = ' ';var addKey = function addKey(isMap, key) {return isMap ? key + ': ' : '';};var addFinalEdgeSpacing = function addFinalEdgeSpacing(length, edgeSpacing) {return length > 0 ? edgeSpacing : '';};var printImmutable = function printImmutable(
val,
print,
indent,
opts,
colors,
immutableDataStructureName,
isMap)
{var _ref =
isMap ? ['{', '}'] : ['[', ']'],_ref2 = (0, _slicedToArray3.default)(_ref, 2),openTag = _ref2[0],closeTag = _ref2[1];
var result =
IMMUTABLE_NAMESPACE +
immutableDataStructureName +
SPACE +
openTag +
opts.edgeSpacing;
var immutableArray = [];
val.forEach(function (item, key) {return (
immutableArray.push(
indent(addKey(isMap, key) + print(item, print, indent, opts, colors))));});
result += immutableArray.join(',' + opts.spacing);
if (!opts.min && immutableArray.length > 0) {
result += ',';
}
return (
result +
addFinalEdgeSpacing(immutableArray.length, opts.edgeSpacing) +
closeTag);
};
module.exports = printImmutable;