Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'deprecation' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
return;
}
// Otherwise log a deprecation message
const [deprecationMethod, deprecationMessapge] = isBasicAuthString
? [
deprecateAuthBasic,
'Setting the "new Octokit({ auth })" option to a Basic Auth string is deprecated. Use https://github.com/octokit/auth-basic.js instead. See (https://octokit.github.io/rest.js/#authentication)'
]
: [
deprecateAuthObject,
'Setting the "new Octokit({ auth })" option to an object without also setting the "authStrategy" option is deprecated and will be removed in v17. See (https://octokit.github.io/rest.js/#authentication)'
];
deprecationMethod(
octokit.log,
new Deprecation("[@octokit/rest] " + deprecationMessapge)
);
octokit.auth = () =>
Promise.resolve({
type: "deprecated",
message: deprecationMessapge
});
validate(options.auth);
const state = {
octokit,
auth: options.auth
};
octokit.hook.before("request", beforeRequest.bind(null, state));
if (options.userAgent) {
clientDefaults.headers["user-agent"] = options.userAgent;
}
if (options.previews) {
clientDefaults.mediaType.previews = options.previews;
}
if (options.timeZone) {
clientDefaults.headers["time-zone"] = options.timeZone;
}
if (options.timeout) {
deprecateOptionsTimeout(
log,
new Deprecation(
"[@octokit/rest] new Octokit({timeout}) is deprecated. Use {request: {timeout}} instead. See https://github.com/octokit/request.js#request"
)
);
clientDefaults.request.timeout = options.timeout;
}
if (options.agent) {
deprecateOptionsAgent(
log,
new Deprecation(
"[@octokit/rest] new Octokit({agent}) is deprecated. Use {request: {agent}} instead. See https://github.com/octokit/request.js#request"
)
);
clientDefaults.request.agent = options.agent;
}
get() {
logOnce(new Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
return statusCode;
}
get() {
logOnce(new deprecation.Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
return statusCode;
}
Object.keys(options).forEach(key => {
if (apiOptions.params[key] && apiOptions.params[key].deprecated) {
const aliasKey = apiOptions.params[key].alias;
octokit.log.warn(new Deprecation(`[@octokit/rest] "${key}" parameter is deprecated for "${methodName}". Use "${aliasKey}" instead`));
if (!(aliasKey in options)) {
options[aliasKey] = options[key];
}
delete options[key];
}
});
return method(options);
get() {
logOnce(new Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
return statusCode;
},
});
get() {
logOnce(new Deprecation("[@octokit/request-error] `error.code` is deprecated, use `error.status`."));
return statusCode;
}
});
get() {
deprecateIncompleteResults(
octokit.log,
new Deprecation(
'[@octokit/rest] "result.data.incomplete_results" is deprecated.'
)
);
return incompleteResults;
}
});
Object.keys(options).forEach(key => {
if (apiOptions.params[key] && apiOptions.params[key].deprecated) {
const aliasKey = apiOptions.params[key].alias;
octokit.log.warn(
new Deprecation(
`[@octokit/rest] "${key}" parameter is deprecated for "${methodName}". Use "${aliasKey}" instead`
)
);
if (!(aliasKey in options)) {
options[aliasKey] = options[key];
}
delete options[key];
}
});
get() {
deprecateTotalCount(
octokit.log,
new Deprecation(
'[@octokit/rest] "result.data.repository_selection" is deprecated.'
)
);
return repositorySelection;
}
});