本文整理汇总了TypeScript中util.inspect函数的典型用法代码示例。如果您正苦于以下问题:TypeScript inspect函数的具体用法?TypeScript inspect怎么用?TypeScript inspect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了inspect函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: format
const plylogPrettify = format((info: TransformableInfo, opts: any) => {
if (info[SPLAT]) {
for (const splat of info[SPLAT]) {
info.message += '\n' + inspect(splat, false, opts.depth || null, opts.colorize);
}
}
info[MESSAGE] = `${info.level}:${info.message}`;
return info;
});
开发者ID:Polymer,项目名称:plylog,代码行数:9,代码来源:index.ts
示例2: constructor
constructor(node: Base, message: string | null = null) {
let prefix = message ? `${message}\n\n` : '';
super(`${prefix}node type '${node.constructor.name}' is not supported: ${inspect(node)}`);
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
Object.setPrototypeOf(this, UnsupportedNodeError.prototype);
this.node = node;
}
开发者ID:alangpierce,项目名称:decaffeinate-parser,代码行数:9,代码来源:UnsupportedNodeError.ts
示例3: it
it("encodes and decodes a future date (timestamp 96)", () => {
const date = new Date(0x400000000 * 1000);
const encoded = defaultCodec.tryToEncode(date);
assert.deepStrictEqual(
defaultCodec.decode(encoded!.data, EXT_TIMESTAMP),
date,
`date: ${date.toISOString()}, encoded: ${util.inspect(encoded)}`,
);
});
开发者ID:msgpack,项目名称:msgpack-javascript,代码行数:9,代码来源:ExtensionCodec.test.ts
示例4: function
log = function (...msg: any[]) {
let out: string[] = [];
for (let m of msg) {
if (typeof(m) === "string") {
out.push(m);
} else if (m instanceof Array) {
for (let i = 0; i < m.length; ++i) {
out.push("\n" + i + ": " +
util.inspect(m[i], { depth: null, colors: true }));
}
} else {
out.push(util.inspect(m, { depth: null, colors: true }));
}
}
// Work around a TypeScript limitation:
// https://github.com/Microsoft/TypeScript/issues/4755
console.log(out[0], ...out.slice(1));
}
开发者ID:Microsoft,项目名称:staticstaging,代码行数:18,代码来源:ssc.ts
示例5: handleRequestSpecs
handleRequestSpecs(method, args, res) {
const filename = args[0];
logger.debug(`requested specs for ${filename}`);
// Can return null if there is nothing defined in plugin
const plugin = this.getPlugin(filename, { noCreateInstance: true });
const specs = (plugin && plugin.specs) || [];
res.send(specs);
logger.debug(`specs: ${util.inspect(specs)}`);
}
开发者ID:billyvg,项目名称:node-client,代码行数:9,代码来源:index.ts
示例6: it
it('should return a summary', function() {
const container = createContainer().register({
val1: asValue(1),
val2: asValue(2),
fn1: asFunction(() => true),
c1: asClass(Repo)
})
expect(util.inspect(container)).toBe(
'[AwilixContainer (registrations: 4)]'
)
expect(
util.inspect(container.createScope().register({ val3: asValue(3) }))
).toBe('[AwilixContainer (scoped, registrations: 5)]')
expect(container.resolve('inspect')).toBeInstanceOf(Function)
expect(container.resolve(util.inspect.custom)).toBeInstanceOf(Function)
})
开发者ID:jeffijoe,项目名称:awilix,代码行数:18,代码来源:container.test.ts
示例7: function
session.getId(), statusObj, function(error: Error, automate_session: any) {
if (error) {
throw new BrowserError(
logger, 'Error updating BrowserStack pass/fail status: ' + util.inspect(error));
} else {
logger.info(automate_session);
deferred.resolve();
}
});
开发者ID:DylanLacey,项目名称:protractor,代码行数:9,代码来源:browserStack.ts
示例8:
items = items.map(item => {
if (item instanceof Error) {
return item.stack;
}
if (R.is(Object, item)) {
// Object formatted with colors (JSON).
return nodeUtil.inspect(item, false, undefined, true);
}
return item;
});
开发者ID:philcockfield,项目名称:js-util-log,代码行数:10,代码来源:log.ts
示例9: validateVega
function validateVega(vegaSpec: VgSpec) {
const valid = validateVg(vegaSpec);
const errors = validateVg.errors;
if (!valid) {
console.log(inspect(errors, {depth: 10, colors: true}));
}
expect(errors && errors.map((err: Ajv.ErrorObject) => err.message).join(', ')).toBeNull();
expect(valid).toBe(true);
}
开发者ID:vega,项目名称:vega-lite,代码行数:10,代码来源:examples.test.ts
注:本文中的util.inspect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论