@contentful/rich-text-react-renderer
Advanced tools
Comparing version 15.4.0 to 15.5.1
@@ -144,8 +144,14 @@ 'use strict'; | ||
// `isCallable` abstract operation | ||
// https://tc39.es/ecma262/#sec-iscallable | ||
var isCallable = function (argument) { | ||
return typeof argument === 'function'; | ||
}; | ||
var isObject = function (it) { | ||
return typeof it === 'object' ? it !== null : typeof it === 'function'; | ||
return typeof it === 'object' ? it !== null : isCallable(it); | ||
}; | ||
var aFunction = function (variable) { | ||
return typeof variable == 'function' ? variable : undefined; | ||
var aFunction = function (argument) { | ||
return isCallable(argument) ? argument : undefined; | ||
}; | ||
@@ -203,5 +209,26 @@ | ||
var $Symbol = getBuiltIn('Symbol'); | ||
return typeof $Symbol == 'function' && Object(it) instanceof $Symbol; | ||
return isCallable($Symbol) && Object(it) instanceof $Symbol; | ||
}; | ||
var tryToString = function (argument) { | ||
try { | ||
return String(argument); | ||
} catch (error) { | ||
return 'Object'; | ||
} | ||
}; | ||
// `Assert: IsCallable(argument) is true` | ||
var aCallable = function (argument) { | ||
if (isCallable(argument)) return argument; | ||
throw TypeError(tryToString(argument) + ' is not a function'); | ||
}; | ||
// `GetMethod` abstract operation | ||
// https://tc39.es/ecma262/#sec-getmethod | ||
var getMethod = function (V, P) { | ||
var func = V[P]; | ||
return func == null ? undefined : aCallable(func); | ||
}; | ||
// `OrdinaryToPrimitive` abstract operation | ||
@@ -211,5 +238,5 @@ // https://tc39.es/ecma262/#sec-ordinarytoprimitive | ||
var fn, val; | ||
if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; | ||
if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val; | ||
if (isCallable(fn = input.valueOf) && !isObject(val = fn.call(input))) return val; | ||
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val; | ||
throw TypeError("Can't convert object to primitive value"); | ||
@@ -236,3 +263,3 @@ }; | ||
})('versions', []).push({ | ||
version: '3.17.3', | ||
version: '3.18.0', | ||
mode: 'global', | ||
@@ -282,5 +309,5 @@ copyright: '© 2021 Denis Pushkarev (zloirock.ru)' | ||
if (!isObject(input) || isSymbol(input)) return input; | ||
var exoticToPrim = input[TO_PRIMITIVE]; | ||
var exoticToPrim = getMethod(input, TO_PRIMITIVE); | ||
var result; | ||
if (exoticToPrim !== undefined) { | ||
if (exoticToPrim) { | ||
if (pref === undefined) pref = 'default'; | ||
@@ -336,6 +363,6 @@ result = exoticToPrim.call(input, pref); | ||
var anObject = function (it) { | ||
if (!isObject(it)) { | ||
throw TypeError(String(it) + ' is not an object'); | ||
} return it; | ||
// `Assert: Type(argument) is Object` | ||
var anObject = function (argument) { | ||
if (isObject(argument)) return argument; | ||
throw TypeError(String(argument) + ' is not an object'); | ||
}; | ||
@@ -374,3 +401,3 @@ | ||
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper | ||
if (typeof sharedStore.inspectSource != 'function') { | ||
if (!isCallable(sharedStore.inspectSource)) { | ||
sharedStore.inspectSource = function (it) { | ||
@@ -385,3 +412,3 @@ return functionToString.call(it); | ||
var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); | ||
var nativeWeakMap = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap)); | ||
@@ -455,3 +482,20 @@ var keys = shared('keys'); | ||
var FunctionPrototype = Function.prototype; | ||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe | ||
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor; | ||
var EXISTS$1 = has(FunctionPrototype, 'name'); | ||
// additional protection from minified / mangled / dropped function names | ||
var PROPER = EXISTS$1 && (function something() { /* empty */ }).name === 'something'; | ||
var CONFIGURABLE = EXISTS$1 && (!descriptors || (descriptors && getDescriptor(FunctionPrototype, 'name').configurable)); | ||
var functionName = { | ||
EXISTS: EXISTS$1, | ||
PROPER: PROPER, | ||
CONFIGURABLE: CONFIGURABLE | ||
}; | ||
var redefine = createCommonjsModule(function (module) { | ||
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE; | ||
var getInternalState = internalState.get; | ||
@@ -465,10 +509,14 @@ var enforceInternalState = internalState.enforce; | ||
var noTargetGet = options ? !!options.noTargetGet : false; | ||
var name = options && options.name !== undefined ? options.name : key; | ||
var state; | ||
if (typeof value == 'function') { | ||
if (typeof key == 'string' && !has(value, 'name')) { | ||
createNonEnumerableProperty(value, 'name', key); | ||
if (isCallable(value)) { | ||
if (String(name).slice(0, 7) === 'Symbol(') { | ||
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']'; | ||
} | ||
if (!has(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { | ||
createNonEnumerableProperty(value, 'name', name); | ||
} | ||
state = enforceInternalState(value); | ||
if (!state.source) { | ||
state.source = TEMPLATE.join(typeof key == 'string' ? key : ''); | ||
state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); | ||
} | ||
@@ -489,3 +537,3 @@ } | ||
})(Function.prototype, 'toString', function toString() { | ||
return typeof this == 'function' && getInternalState(this).source || inspectSource(this); | ||
return isCallable(this) && getInternalState(this).source || inspectSource(this); | ||
}); | ||
@@ -621,3 +669,3 @@ }); | ||
: value == NATIVE ? false | ||
: typeof detection == 'function' ? fails(detection) | ||
: isCallable(detection) ? fails(detection) | ||
: !!detection; | ||
@@ -656,2 +704,3 @@ }; | ||
options.noTargetGet - prevent calling a getter on target | ||
options.name - the .name of the function if it does not match the key | ||
*/ | ||
@@ -871,11 +920,5 @@ var _export = function (options, source) { | ||
var aFunction$1 = function (it) { | ||
if (typeof it != 'function') { | ||
throw TypeError(String(it) + ' is not a function'); | ||
} return it; | ||
}; | ||
// optional / simple context binding | ||
var functionBindContext = function (fn, that, length) { | ||
aFunction$1(fn); | ||
aCallable(fn); | ||
if (that === undefined) return fn; | ||
@@ -1022,2 +1065,27 @@ switch (length) { | ||
_a); | ||
/** | ||
* Node types before `tables` release. | ||
*/ | ||
var V1_NODE_TYPES = [ | ||
BLOCKS$1.DOCUMENT, | ||
BLOCKS$1.PARAGRAPH, | ||
BLOCKS$1.HEADING_1, | ||
BLOCKS$1.HEADING_2, | ||
BLOCKS$1.HEADING_3, | ||
BLOCKS$1.HEADING_4, | ||
BLOCKS$1.HEADING_5, | ||
BLOCKS$1.HEADING_6, | ||
BLOCKS$1.OL_LIST, | ||
BLOCKS$1.UL_LIST, | ||
BLOCKS$1.LIST_ITEM, | ||
BLOCKS$1.HR, | ||
BLOCKS$1.QUOTE, | ||
BLOCKS$1.EMBEDDED_ENTRY, | ||
BLOCKS$1.EMBEDDED_ASSET, | ||
INLINES$1.HYPERLINK, | ||
INLINES$1.ENTRY_HYPERLINK, | ||
INLINES$1.ASSET_HYPERLINK, | ||
INLINES$1.EMBEDDED_ENTRY, | ||
'text', | ||
]; | ||
@@ -1081,2 +1149,3 @@ /** | ||
exports.TOP_LEVEL_BLOCKS = TOP_LEVEL_BLOCKS; | ||
exports.V1_NODE_TYPES = V1_NODE_TYPES; | ||
exports.VOID_BLOCKS = VOID_BLOCKS; | ||
@@ -1096,4 +1165,5 @@ exports.helpers = helpers; | ||
var richTextTypes_es5_8 = richTextTypes_es5.TOP_LEVEL_BLOCKS; | ||
var richTextTypes_es5_9 = richTextTypes_es5.VOID_BLOCKS; | ||
var richTextTypes_es5_10 = richTextTypes_es5.helpers; | ||
var richTextTypes_es5_9 = richTextTypes_es5.V1_NODE_TYPES; | ||
var richTextTypes_es5_10 = richTextTypes_es5.VOID_BLOCKS; | ||
var richTextTypes_es5_11 = richTextTypes_es5.helpers; | ||
@@ -1114,3 +1184,3 @@ function appendKeyToValidElement(element, key) { | ||
var renderNode = options.renderNode, renderMark = options.renderMark, renderText = options.renderText; | ||
if (richTextTypes_es5_10.isText(node)) { | ||
if (richTextTypes_es5_11.isText(node)) { | ||
return node.marks.reduce(function (value, mark) { | ||
@@ -1117,0 +1187,0 @@ if (!renderMark[mark.type]) { |
{ | ||
"name": "@contentful/rich-text-react-renderer", | ||
"version": "15.4.0", | ||
"version": "15.5.1", | ||
"main": "dist/rich-text-react-renderer.es5.js", | ||
@@ -27,3 +27,3 @@ "typings": "dist/types/index.d.ts", | ||
"dependencies": { | ||
"@contentful/rich-text-types": "^15.3.6" | ||
"@contentful/rich-text-types": "^15.5.1" | ||
}, | ||
@@ -51,3 +51,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "da337044362408b63ebe6e6377cb9fdd61bd8277" | ||
"gitHead": "f1e1e5792731ffd4800e9c7136425d4306d8ef87" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
210002
2323
73
2