本文整理匯總了TypeScript中@ember/utils.isEmpty函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isEmpty函數的具體用法?TypeScript isEmpty怎麽用?TypeScript isEmpty使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isEmpty函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: isEmpty
(function() {
/** isEmpty */
// TODO fix upstream in @types/ember https://github.com/typed-ember/ember-cli-typescript/issues/255
// isEmpty(); // $ExpectType boolean
isEmpty(null); // $ExpectType boolean
isEmpty(undefined); // $ExpectType boolean
isEmpty(''); // $ExpectType boolean
isEmpty([]); // $ExpectType boolean
isEmpty({ size: 0 }); // $ExpectType boolean
isEmpty({}); // $ExpectType boolean
isEmpty('Adam Hawkins'); // $ExpectType boolean
isEmpty([0, 1, 2]); // $ExpectType boolean
isEmpty('\n\t'); // $ExpectType boolean
isEmpty(' '); // $ExpectType boolean
isEmpty({ size: 1 }); // $ExpectType boolean
isEmpty({ size: () => 0 }); // $ExpectType boolean
})();
示例2: isEmpty
(function() {
/** isEmpty */
isEmpty(); // $ExpectType boolean
isEmpty(null); // $ExpectType boolean
isEmpty(undefined); // $ExpectType boolean
isEmpty(''); // $ExpectType boolean
isEmpty([]); // $ExpectType boolean
isEmpty({ size: 0 }); // $ExpectType boolean
isEmpty({}); // $ExpectType boolean
isEmpty('Adam Hawkins'); // $ExpectType boolean
isEmpty([0, 1, 2]); // $ExpectType boolean
isEmpty('\n\t'); // $ExpectType boolean
isEmpty(' '); // $ExpectType boolean
isEmpty({ size: 1 }); // $ExpectType boolean
isEmpty({ size: () => 0 }); // $ExpectType boolean
})();
示例3: testIsEmpty
function testIsEmpty() {
utils.isEmpty(); // $ExpectType boolean
utils.isEmpty(''); // $ExpectType boolean
utils.isEmpty('', ''); // $ExpectError
}
示例4: _getFullHeadersHash
*/
_getFullHeadersHash(headers?: Headers): Headers {
const classHeaders = get(this, 'headers');
return assign({}, classHeaders!, headers!);
},
/**
* Created a normalized set of options from the per-request and
* service-level settings
*/
options(url: string, options: AJAXOptions = {}): AJAXOptions {
options = assign({}, options);
options.url = this._buildURL(url, options);
options.type = options.type || 'GET';
options.dataType = options.dataType || 'json';
options.contentType = isEmpty(options.contentType)
? get(this, 'contentType')
: options.contentType;
if (this._shouldSendHeaders(options)) {
options.headers = this._getFullHeadersHash(options.headers);
} else {
options.headers = options.headers || {};
}
return options;
},
/**
* Build a URL for a request
*