mirror of
https://github.com/r0adkll/sign-android-release
synced 2026-09-29 08:08:38 +00:00
bump jest and make tests pass
This commit is contained in:
+17
-40
@@ -7,38 +7,14 @@ exports.default = exports.serialize = exports.test = void 0;
|
||||
|
||||
var _collections = require('../collections');
|
||||
|
||||
function _objectSpread(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(
|
||||
Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
})
|
||||
);
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/* eslint-disable local/ban-types-eventually */
|
||||
const SPACE = ' ';
|
||||
const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
|
||||
const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
|
||||
@@ -49,15 +25,13 @@ const testName = name =>
|
||||
const test = val =>
|
||||
val &&
|
||||
val.constructor &&
|
||||
val.constructor.name &&
|
||||
testName(val.constructor.name); // Convert array of attribute objects to props object.
|
||||
!!val.constructor.name &&
|
||||
testName(val.constructor.name);
|
||||
|
||||
exports.test = test;
|
||||
|
||||
const propsReducer = (props, attribute) => {
|
||||
props[attribute.name] = attribute.value;
|
||||
return props;
|
||||
};
|
||||
const isNamedNodeMap = collection =>
|
||||
collection.constructor.name === 'NamedNodeMap';
|
||||
|
||||
const serialize = (collection, config, indentation, depth, refs, printer) => {
|
||||
const name = collection.constructor.name;
|
||||
@@ -71,9 +45,12 @@ const serialize = (collection, config, indentation, depth, refs, printer) => {
|
||||
(OBJECT_NAMES.indexOf(name) !== -1
|
||||
? '{' +
|
||||
(0, _collections.printObjectProperties)(
|
||||
name === 'NamedNodeMap'
|
||||
? Array.prototype.reduce.call(collection, propsReducer, {})
|
||||
: _objectSpread({}, collection),
|
||||
isNamedNodeMap(collection)
|
||||
? Array.from(collection).reduce((props, attribute) => {
|
||||
props[attribute.name] = attribute.value;
|
||||
return props;
|
||||
}, {})
|
||||
: {...collection},
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
|
||||
Reference in New Issue
Block a user