本文整理汇总了TypeScript中vs/base/common/types.isEmptyObject函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isEmptyObject函数的具体用法?TypeScript isEmptyObject怎么用?TypeScript isEmptyObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isEmptyObject函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('Creation', function () {
let b = new Builder(document.getElementById(fixtureId));
b.div().hide();
let part = new MyPart(b.getHTMLElement());
part.create(b.getHTMLElement());
assert.strictEqual(part.getId(), 'myPart');
// Memento
let memento = part.getMemento(storage);
assert(memento);
memento.foo = 'bar';
memento.bar = [1, 2, 3];
part.shutdown();
// Re-Create to assert memento contents
part = new MyPart(b.getHTMLElement());
memento = part.getMemento(storage);
assert(memento);
assert.strictEqual(memento.foo, 'bar');
assert.strictEqual(memento.bar.length, 3);
// Empty Memento stores empty object
delete memento.foo;
delete memento.bar;
part.shutdown();
part = new MyPart(b.getHTMLElement());
memento = part.getMemento(storage);
assert(memento);
assert.strictEqual(Types.isEmptyObject(memento), true);
});
示例2: test
test('MarkdownConvert - uris', function () {
let data = MarkdownString.from('Hello');
assert.equal(isEmptyObject(data.uris), true);
assert.equal(data.value, 'Hello');
data = MarkdownString.from('Hello [link](foo)');
assert.equal(data.value, 'Hello [link](foo)');
assert.equal(isEmptyObject(data.uris), true); // no scheme, no uri
data = MarkdownString.from('Hello [link](www.noscheme.bad)');
assert.equal(data.value, 'Hello [link](www.noscheme.bad)');
assert.equal(isEmptyObject(data.uris), true); // no scheme, no uri
data = MarkdownString.from('Hello [link](foo:path)');
assert.equal(data.value, 'Hello [link](foo:path)');
assert.equal(size(data.uris!), 1);
assert.ok(!!data.uris!['foo:path']);
data = MarkdownString.from('hello@foo.bar');
assert.equal(data.value, 'hello@foo.bar');
assert.equal(size(data.uris!), 1);
assert.ok(!!data.uris!['mailto:hello@foo.bar']);
data = MarkdownString.from('*hello* [click](command:me)');
assert.equal(data.value, '*hello* [click](command:me)');
assert.equal(size(data.uris!), 1);
assert.ok(!!data.uris!['command:me']);
data = MarkdownString.from('*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
assert.equal(data.value, '*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
assert.equal(size(data.uris!), 1);
assert.ok(!!data.uris!['file:///somepath/here']);
data = MarkdownString.from('*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
assert.equal(data.value, '*hello* [click](file:///somepath/here). [click](file:///somepath/here)');
assert.equal(size(data.uris!), 1);
assert.ok(!!data.uris!['file:///somepath/here']);
data = MarkdownString.from('*hello* [click](file:///somepath/here). [click](file:///somepath/here2)');
assert.equal(data.value, '*hello* [click](file:///somepath/here). [click](file:///somepath/here2)');
assert.equal(size(data.uris!), 2);
assert.ok(!!data.uris!['file:///somepath/here']);
assert.ok(!!data.uris!['file:///somepath/here2']);
});
示例3: test
test('Creation', () => {
let b = document.createElement('div');
document.getElementById(fixtureId).appendChild(b);
hide(b);
let part = new MyPart(b);
part.create(b);
assert.strictEqual(part.getId(), 'myPart');
// Memento
let memento = part.getMemento(StorageScope.GLOBAL) as any;
assert(memento);
memento.foo = 'bar';
memento.bar = [1, 2, 3];
part.saveState();
// Re-Create to assert memento contents
part = new MyPart(b);
memento = part.getMemento(StorageScope.GLOBAL);
assert(memento);
assert.strictEqual(memento.foo, 'bar');
assert.strictEqual(memento.bar.length, 3);
// Empty Memento stores empty object
delete memento.foo;
delete memento.bar;
part.saveState();
part = new MyPart(b);
memento = part.getMemento(StorageScope.GLOBAL);
assert(memento);
assert.strictEqual(Types.isEmptyObject(memento), true);
});
示例4: test
test("Creation", function() {
let b = Build.withElementById(fixtureId);
b.div().hide();
let part = new MyPart(b);
part.create(b);
assert.strictEqual(part.getId(), "myPart");
assert.strictEqual(part.getContainer(), b);
// Memento
let memento = part.getMemento(storage);
assert(memento);
memento.foo = "bar";
memento.bar = [1, 2, 3];
part.shutdown();
// Re-Create to assert memento contents
part = new MyPart(b);
memento = part.getMemento(storage);
assert(memento);
assert.strictEqual(memento.foo, "bar");
assert.strictEqual(memento.bar.length, 3);
// Empty Memento stores empty object
delete memento.foo;
delete memento.bar;
part.shutdown();
part = new MyPart(b);
memento = part.getMemento(storage);
assert(memento);
assert.strictEqual(Types.isEmptyObject(memento), true);
});
示例5: test
test('isEmptyObject', () => {
assert(!types.isEmptyObject(undefined));
assert(!types.isEmptyObject(null));
assert(!types.isEmptyObject('foo'));
assert(!types.isEmptyObject(5));
assert(!types.isEmptyObject(true));
assert(!types.isEmptyObject([]));
assert(!types.isEmptyObject([1, 2, '3']));
assert(!types.isEmptyObject(/test/));
assert(!types.isEmptyObject(new RegExp('')));
assert(!types.isEmptyObject(new Date()));
assert(!types.isEmptyObject(assert));
assert(!types.isEmptyObject(function foo() { /**/ }));
assert(!types.isEmptyObject({ foo: 'bar' }));
assert(types.isEmptyObject({}));
});