Lines Matching refs:value
272 // Typically, the target value will be an instance of `Object`. If that is
285 ret.stylize = ObjectSetPrototypeOf((value, flavour) => {
288 stylized = `${ctx.stylize(value, flavour)}`;
293 if (typeof stylized !== 'string') return value;
303 * Echos the value of any input. Tries to print the value out
305 * @param {any} value The value to print out.
308 /* Legacy: value, showHidden, depth, colors */
309 function inspect(value, opts) {
364 return formatValue(ctx, value, 0);
439 set(value) {
440 this[target] = value;
593 typeof descriptor.value === 'function' &&
594 descriptor.value.name !== '' &&
595 isInstanceof(tmp, descriptor.value)) {
598 !builtInObjects.has(descriptor.value.name))) {
602 return String(descriptor.value.name);
652 typeof descriptor.value === 'function' &&
653 builtInObjects.has(descriptor.value.name)) {
674 if (typeof desc.value === 'function') {
677 const value = formatProperty(
681 ArrayPrototypePush(output, `\u001b[2m${value}\u001b[22m`);
683 ArrayPrototypePush(output, value);
708 function getKeys(value, showHidden) {
710 const symbols = ObjectGetOwnPropertySymbols(value);
712 keys = ObjectGetOwnPropertyNames(value);
716 // This might throw if `value` is a Module Namespace Object from an
722 keys = ObjectKeys(value);
725 isModuleNamespaceObject(value));
726 keys = ObjectGetOwnPropertyNames(value);
729 const filter = (key) => ObjectPrototypePropertyIsEnumerable(value, key);
736 function getCtxStyle(value, constructor, tag) {
739 fallback = internalGetConstructorName(value);
764 // value afterwards again.
765 function formatValue(ctx, value, recurseTimes, typedArray) {
767 if (typeof value !== 'object' &&
768 typeof value !== 'function' &&
769 !isUndetectableObject(value)) {
770 return formatPrimitive(ctx.stylize, value, ctx);
772 if (value === null) {
777 const context = value;
780 const proxy = getProxyDetails(value, !!ctx.showProxy);
788 value = proxy;
792 // Check that value is an object with an inspect function on it.
794 const maybeCustom = value[customInspectSymbol];
799 !(value.constructor && value.constructor.prototype === value)) {
825 if (ctx.seen.includes(value)) {
829 ctx.circular.set(value, index);
831 index = ctx.circular.get(value);
834 ctx.circular.set(value, index);
840 return formatRaw(ctx, value, recurseTimes, typedArray);
843 function formatRaw(ctx, value, recurseTimes, typedArray) {
850 const constructor = getConstructorName(value, ctx, recurseTimes, protoProps);
856 let tag = value[SymbolToStringTag];
864 value, SymbolToStringTag,
880 if (SymbolIterator in value || constructor === null) {
882 if (ArrayIsArray(value)) {
885 getPrefix(constructor, tag, 'Array', `(${value.length})`) :
887 keys = getOwnNonIndexProperties(value, filter);
889 if (value.length === 0 && keys.length === 0 && protoProps === undefined)
893 } else if (isSet(value)) {
894 const size = SetPrototypeGetSize(value);
896 keys = getKeys(value, ctx.showHidden);
898 FunctionPrototypeBind(formatSet, null, value) :
899 FunctionPrototypeBind(formatSet, null, SetPrototypeValues(value));
903 } else if (isMap(value)) {
904 const size = MapPrototypeGetSize(value);
906 keys = getKeys(value, ctx.showHidden);
908 FunctionPrototypeBind(formatMap, null, value) :
909 FunctionPrototypeBind(formatMap, null, MapPrototypeEntries(value));
913 } else if (isTypedArray(value)) {
914 keys = getOwnNonIndexProperties(value, filter);
915 let bound = value;
918 fallback = TypedArrayPrototypeGetSymbolToStringTag(value);
920 bound = new primordials[fallback](value);
922 const size = TypedArrayPrototypeGetLength(value);
925 if (value.length === 0 && keys.length === 0 && !ctx.showHidden)
927 // Special handle the value. The original value is required below. The
931 } else if (isMapIterator(value)) {
932 keys = getKeys(value, ctx.showHidden);
936 } else if (isSetIterator(value)) {
937 keys = getKeys(value, ctx.showHidden);
946 keys = getKeys(value, ctx.showHidden);
949 if (isArgumentsObject(value)) {
957 } else if (typeof value === 'function') {
958 base = getFunctionBase(value, constructor, tag);
961 } else if (isRegExp(value)) {
964 constructor !== null ? value : new RegExp(value),
973 } else if (isDate(value)) {
975 base = NumberIsNaN(DatePrototypeGetTime(value)) ?
976 DatePrototypeToString(value) :
977 DatePrototypeToISOString(value);
984 } else if (isError(value)) {
985 base = formatError(value, constructor, tag, ctx, keys);
988 } else if (isAnyArrayBuffer(value)) {
992 const arrayType = isArrayBuffer(value) ? 'ArrayBuffer' :
999 `{ byteLength: ${formatNumber(ctx.stylize, value.byteLength, false)} }`;
1003 } else if (isDataView(value)) {
1007 } else if (isPromise(value)) {
1010 } else if (isWeakSet(value)) {
1013 } else if (isWeakMap(value)) {
1016 } else if (isModuleNamespaceObject(value)) {
1020 } else if (isBoxedPrimitive(value)) {
1021 base = getBoxedBase(value, ctx, keys, constructor, tag);
1027 if (isExternal(value)) {
1028 const address = getExternalValue(value).toString(16);
1031 return `${getCtxStyle(value, constructor, tag)}{}`;
1033 braces[0] = `${getCtxStyle(value, constructor, tag)}{`;
1038 let constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);
1045 ArrayPrototypePush(ctx.seen, value);
1050 output = formatter(ctx, value, recurseTimes);
1054 formatProperty(ctx, value, recurseTimes, keys[i], extrasType),
1061 const constructorName = StringPrototypeSlice(getCtxStyle(value, constructor, tag), 0, -1);
1065 const index = ctx.circular.get(value);
1090 ctx, output, base, braces, extrasType, recurseTimes, value);
1116 function getBoxedBase(value, ctx, keys, constructor, tag) {
1119 if (isNumberObject(value)) {
1122 } else if (isStringObject(value)) {
1128 keys.splice(0, value.length);
1129 } else if (isBooleanObject(value)) {
1132 } else if (isBigIntObject(value)) {
1147 base += `: ${formatPrimitive(stylizeNoColor, fn(value), ctx)}]`;
1156 function getClassBase(value, constructor, tag) {
1157 const hasName = ObjectPrototypeHasOwnProperty(value, 'name');
1158 const name = (hasName && value.name) || '(anonymous)';
1167 const superName = ObjectGetPrototypeOf(value).name;
1177 function getFunctionBase(value, constructor, tag) {
1178 const stringified = FunctionPrototypeToString(value);
1187 return getClassBase(value, constructor, tag);
1191 if (isGeneratorFunction(value)) {
1194 if (isAsyncFunction(value)) {
1201 if (value.name === '') {
1204 base += `: ${value.name}`;
1435 function groupArrayElements(ctx, output, value) {
1505 if (value !== undefined) {
1507 if (typeof value[i] !== 'number' && typeof value[i] !== 'bigint') {
1618 function formatPrimitive(fn, value, ctx) {
1619 if (typeof value === 'string') {
1621 if (value.length > ctx.maxStringLength) {
1622 const remaining = value.length - ctx.maxStringLength;
1623 value = StringPrototypeSlice(value, 0, ctx.maxStringLength);
1630 value.length > kMinLineLength &&
1631 value.length > ctx.breakLength - ctx.indentationLvl - 4) {
1634 RegExpPrototypeSymbolSplit(/(?<=\n)/, value),
1640 return fn(strEscape(value), 'string') + trailer;
1642 if (typeof value === 'number')
1643 return formatNumber(fn, value, ctx.numericSeparator);
1644 if (typeof value === 'bigint')
1645 return formatBigInt(fn, value, ctx.numericSeparator);
1646 if (typeof value === 'boolean')
1647 return fn(`${value}`, 'boolean');
1648 if (typeof value === 'undefined')
1651 return fn(SymbolPrototypeToString(value), 'symbol');
1654 function formatNamespaceObject(keys, ctx, value, recurseTimes) {
1658 output[i] = formatProperty(ctx, value, recurseTimes, keys[i],
1668 // We have to find the last whitespace and have to replace that value as
1680 function formatSpecialArray(ctx, value, recurseTimes, maxLength, output, i) {
1681 const keys = ObjectKeys(value);
1703 ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, key, kArrayType));
1706 const remaining = value.length - index;
1719 function formatArrayBuffer(ctx, value) {
1722 buffer = new Uint8Array(value);
1739 function formatArray(ctx, value, recurseTimes) {
1740 const valLen = value.length;
1747 if (!ObjectPrototypeHasOwnProperty(value, i)) {
1748 return formatSpecialArray(ctx, value, recurseTimes, len, output, i);
1750 ArrayPrototypePush(output, formatProperty(ctx, value, recurseTimes, i, kArrayType));
1758 function formatTypedArray(value, length, ctx, ignored, recurseTimes) {
1760 const remaining = value.length - maxLength;
1762 const elementFormatter = value.length > 0 && typeof value[0] === 'number' ?
1766 output[i] = elementFormatter(ctx.stylize, value[i], ctx.numericSeparator);
1782 const str = formatValue(ctx, value[key], recurseTimes, true);
1790 function formatSet(value, ctx, ignored, recurseTimes) {
1793 for (const v of value) {
1800 function formatMap(value, ctx, ignored, recurseTimes) {
1803 for (const { 0: k, 1: v } of value) {
1878 function formatWeakSet(ctx, value, recurseTimes) {
1879 const entries = previewEntries(value);
1883 function formatWeakMap(ctx, value, recurseTimes) {
1884 const entries = previewEntries(value);
1888 function formatIterator(braces, ctx, value, recurseTimes) {
1889 const { 0: entries, 1: isKeyValue } = previewEntries(value, true);
1899 function formatPromise(ctx, value, recurseTimes) {
1901 const { 0: state, 1: result } = getPromiseDetails(value);
1917 function formatProperty(ctx, value, recurseTimes, key, type, desc,
1918 original = value) {
1921 desc = desc || ObjectGetOwnPropertyDescriptor(value, key) ||
1922 { value: value[key], enumerable: true };
1923 if (desc.value !== undefined) {
1926 str = formatValue(ctx, desc.value, recurseTimes);
2014 ctx, output, base, braces, extrasType, recurseTimes, value) {
2023 output = groupArrayElements(ctx, output, value);
2076 function hasBuiltInToString(value) {
2079 const proxyTarget = getProxyDetails(value, getFullProxy);
2084 value = proxyTarget;
2088 if (typeof value.toString !== 'function') {
2093 if (ObjectPrototypeHasOwnProperty(value, 'toString')) {
2099 let pointer = value;
2107 typeof descriptor.value === 'function' &&
2108 builtInObjects.has(descriptor.value.name);
2277 const value = args[a];
2279 str += typeof value !== 'string' ? inspect(value, inspectOptions) : value;