pretty-format
Advanced tools
Comparing version 19.2.0-alpha.993e64af to 19.3.0-alpha.85402254
@@ -12,3 +12,3 @@ /** | ||
'use strict';var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;}; | ||
'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 _getOwnPropertySymbols = require('babel-runtime/core-js/object/get-own-property-symbols');var _getOwnPropertySymbols2 = _interopRequireDefault(_getOwnPropertySymbols);var _symbol = require('babel-runtime/core-js/symbol');var _symbol2 = _interopRequireDefault(_symbol);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} | ||
@@ -51,3 +51,3 @@ | ||
var regExpToString = RegExp.prototype.toString; | ||
var symbolToString = Symbol.prototype.toString; | ||
var symbolToString = _symbol2.default.prototype.toString; | ||
@@ -57,3 +57,3 @@ var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/; | ||
var getSymbols = Object.getOwnPropertySymbols || function (obj) {return [];}; | ||
var getSymbols = _getOwnPropertySymbols2.default || function (obj) {return [];}; | ||
@@ -118,3 +118,3 @@ function isToStringedArrayType(toStringed) { | ||
var typeOf = typeof val === 'undefined' ? 'undefined' : _typeof(val); | ||
var typeOf = typeof val === 'undefined' ? 'undefined' : (0, _typeof3.default)(val); | ||
@@ -400,3 +400,3 @@ if (typeOf === 'number') { | ||
var result = constructor + '{'; | ||
var keys = Object.keys(val).sort(); | ||
var keys = (0, _keys2.default)(val).sort(); | ||
var symbols = getSymbols(val); | ||
@@ -409,3 +409,3 @@ | ||
// $FlowFixMe string literal `symbol`. This value is not a valid `typeof` return value | ||
!((typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'symbol' || | ||
!((typeof key === 'undefined' ? 'undefined' : (0, _typeof3.default)(key)) === 'symbol' || | ||
toString.call(key) === '[object Symbol]'));}). | ||
@@ -818,3 +818,3 @@ | ||
function validateOptions(opts) { | ||
Object.keys(opts).forEach(function (key) { | ||
(0, _keys2.default)(opts).forEach(function (key) { | ||
if (!DEFAULTS.hasOwnProperty(key)) { | ||
@@ -835,3 +835,3 @@ throw new Error('pretty-format: Unknown option "' + key + '".'); | ||
Object.keys(DEFAULTS).forEach( | ||
(0, _keys2.default)(DEFAULTS).forEach( | ||
function (key) {return ( | ||
@@ -856,5 +856,5 @@ result[key] = opts.hasOwnProperty(key) ? | ||
if ((typeof themeOption === 'undefined' ? 'undefined' : _typeof(themeOption)) !== 'object') { | ||
if ((typeof themeOption === 'undefined' ? 'undefined' : (0, _typeof3.default)(themeOption)) !== 'object') { | ||
throw new Error('pretty-format: Option "theme" must be of type "object" but instead received "' + (typeof | ||
themeOption === 'undefined' ? 'undefined' : _typeof(themeOption)) + '".'); | ||
themeOption === 'undefined' ? 'undefined' : (0, _typeof3.default)(themeOption)) + '".'); | ||
@@ -866,3 +866,3 @@ } | ||
var themeDefaults = DEFAULTS.theme; | ||
return Object.keys(themeDefaults).reduce(function (theme, key) { | ||
return (0, _keys2.default)(themeDefaults).reduce(function (theme, key) { | ||
theme[key] = Object.prototype.hasOwnProperty.call(themeOption, key) ? | ||
@@ -895,3 +895,3 @@ themeRefined[key] : | ||
Object.keys(opts.theme).forEach(function (key) { | ||
(0, _keys2.default)(opts.theme).forEach(function (key) { | ||
if (opts.highlight) { | ||
@@ -898,0 +898,0 @@ var color = colors[key] = style[opts.theme[key]]; |
@@ -11,11 +11,11 @@ /** | ||
'use strict';function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self, call) {if (!self) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call && (typeof call === "object" || typeof call === "function") ? call : self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;} | ||
'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 = Symbol.for('jest.asymmetricMatcher'); | ||
var asymmetricMatcher = (0, _for2.default)('jest.asymmetricMatcher'); | ||
var SPACE = ' ';var | ||
ArrayContaining = function (_Array) {_inherits(ArrayContaining, _Array);function ArrayContaining() {_classCallCheck(this, ArrayContaining);return _possibleConstructorReturn(this, (ArrayContaining.__proto__ || Object.getPrototypeOf(ArrayContaining)).apply(this, arguments));}return ArrayContaining;}(Array);var | ||
ObjectContaining = function (_Object) {_inherits(ObjectContaining, _Object);function ObjectContaining() {_classCallCheck(this, ObjectContaining);return _possibleConstructorReturn(this, (ObjectContaining.__proto__ || Object.getPrototypeOf(ObjectContaining)).apply(this, arguments));}return ObjectContaining;}(Object); | ||
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); | ||
@@ -39,3 +39,3 @@ var print = function print( | ||
if (stringedValue === 'ObjectContaining') { | ||
var object = Object.assign(new ObjectContaining(), val.sample); | ||
var object = (0, _assign2.default)(new ObjectContaining(), val.sample); | ||
return opts.spacing === SPACE ? | ||
@@ -42,0 +42,0 @@ stringedValue + SPACE + _print(object) : |
@@ -11,3 +11,3 @@ /** | ||
'use strict';var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;}; | ||
'use strict';var _typeof2 = require('babel-runtime/helpers/typeof');var _typeof3 = _interopRequireDefault(_typeof2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} | ||
@@ -39,2 +39,3 @@ | ||
var HTML_ELEMENT_REGEXP = /(HTML\w*?Element)|Text|Comment/; | ||
@@ -57,3 +58,3 @@ var test = isHTMLElement; | ||
map(function (node) { | ||
if ((typeof node === 'undefined' ? 'undefined' : _typeof(node)) === 'object') { | ||
if ((typeof node === 'undefined' ? 'undefined' : (0, _typeof3.default)(node)) === 'object') { | ||
return print(node, print, indent, colors, opts); | ||
@@ -66,2 +67,3 @@ } else if (typeof node === 'string') { | ||
}). | ||
filter(function (value) {return value.trim().length;}). | ||
join(opts.edgeSpacing); | ||
@@ -93,6 +95,14 @@ } | ||
if (element.nodeType === 3) { | ||
return element.data; | ||
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 + '-->' + colors.comment.close); | ||
colors.comment.open + | ||
'<!-- ' + | ||
element.data.trim() + | ||
' -->' + | ||
colors.comment.close); | ||
@@ -99,0 +109,0 @@ } |
@@ -11,3 +11,3 @@ /** | ||
'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}(); | ||
'use strict';var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} | ||
@@ -33,3 +33,3 @@ | ||
{var _ref = | ||
isMap ? ['{', '}'] : ['[', ']'],_ref2 = _slicedToArray(_ref, 2),openTag = _ref2[0],closeTag = _ref2[1]; | ||
isMap ? ['{', '}'] : ['[', ']'],_ref2 = (0, _slicedToArray3.default)(_ref, 2),openTag = _ref2[0],closeTag = _ref2[1]; | ||
var result = | ||
@@ -36,0 +36,0 @@ IMMUTABLE_NAMESPACE + |
@@ -11,3 +11,3 @@ /** | ||
'use strict';var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;}; | ||
'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 };} | ||
@@ -18,3 +18,3 @@ | ||
var reactElement = Symbol.for('react.element'); | ||
var reactElement = (0, _for2.default)('react.element'); | ||
@@ -32,3 +32,3 @@ function traverseChildren(opaqueChildren, cb) { | ||
map(function (node) { | ||
if ((typeof node === 'undefined' ? 'undefined' : _typeof(node)) === 'object') { | ||
if ((typeof node === 'undefined' ? 'undefined' : (0, _typeof3.default)(node)) === 'object') { | ||
return print(node, print, indent, colors, opts); | ||
@@ -45,3 +45,3 @@ } else if (typeof node === 'string') { | ||
function printProps(props, print, indent, colors, opts) { | ||
return Object.keys(props). | ||
return (0, _keys2.default)(props). | ||
sort(). | ||
@@ -98,3 +98,3 @@ map(function (name) { | ||
var opaqueChildren = element.props.children; | ||
var hasProps = !!Object.keys(element.props).filter( | ||
var hasProps = !!(0, _keys2.default)(element.props).filter( | ||
function (propName) {return propName !== 'children';}). | ||
@@ -101,0 +101,0 @@ length; |
@@ -11,3 +11,3 @@ /** | ||
'use strict'; | ||
'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 };} | ||
@@ -26,3 +26,3 @@ | ||
var reactTestInstance = Symbol.for('react.test.json'); | ||
var reactTestInstance = (0, _for2.default)('react.test.json'); | ||
@@ -42,3 +42,3 @@ function printChildren( | ||
function printProps(props, print, indent, colors, opts) { | ||
return Object.keys(props). | ||
return (0, _keys2.default)(props). | ||
sort(). | ||
@@ -82,3 +82,3 @@ map(function (name) { | ||
if (instance.props) { | ||
closeInNewLine = !!Object.keys(instance.props).length && !opts.min; | ||
closeInNewLine = !!(0, _keys2.default)(instance.props).length && !opts.min; | ||
result += printProps(instance.props, print, indent, colors, opts); | ||
@@ -85,0 +85,0 @@ } |
@@ -38,2 +38,3 @@ /** | ||
const HTML_ELEMENT_REGEXP = /(HTML\w*?Element)|Text|Comment/; | ||
@@ -64,2 +65,3 @@ const test = isHTMLElement; | ||
}). | ||
filter(value => value.trim().length). | ||
join(opts.edgeSpacing); | ||
@@ -91,6 +93,14 @@ } | ||
if (element.nodeType === 3) { | ||
return element.data; | ||
return element.data. | ||
split('\n'). | ||
map(text => text.trimLeft()). | ||
filter(text => text.length). | ||
join(' '); | ||
} else if (element.nodeType === 8) { | ||
return ( | ||
colors.comment.open + '<!--' + element.data + '-->' + colors.comment.close); | ||
colors.comment.open + | ||
'<!-- ' + | ||
element.data.trim() + | ||
' -->' + | ||
colors.comment.close); | ||
@@ -97,0 +107,0 @@ } |
{ | ||
"name": "pretty-format", | ||
"version": "19.2.0-alpha.993e64af", | ||
"version": "19.3.0-alpha.85402254", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
341223
4123