0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

replaced deprecated String.prototype.substr() (#14367)

- `.substr()` is deprecated so we replace it with .slice() which works similarly but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
CommanderRoot 2022-04-28 12:49:12 +02:00 committed by GitHub
parent aacb30e35e
commit adc0805dce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -337,7 +337,7 @@ module.exports = function (grunt) {
// A list of files and patterns to include when creating a release zip.
// This is read from the `.npmignore` file and all patterns are inverted as we want to define what to include
src: fs.readFileSync('.npmignore', 'utf8').split('\n').filter(Boolean).map(function (pattern) {
return pattern[0] === '!' ? pattern.substr(1) : '!' + pattern;
return pattern[0] === '!' ? pattern.slice(1) : '!' + pattern;
}),
dest: '<%= paths.releaseBuild %>/'
});

View file

@ -80,7 +80,7 @@ function resolvePaths(globals, data, value) {
path = path.replace(/\.\[/g, '[');
if (path.charAt(0) === '@') {
result = jsonpath.query(globals, path.substr(1));
result = jsonpath.query(globals, path.slice(1));
} else {
// Do the query, which always returns an array of matches
result = jsonpath.query(data, path);

View file

@ -79,7 +79,7 @@ module.exports = function (Bookshelf) {
// If it's a user, let's try to cut it down (unless this is a human request)
if (baseName === 'user' && options && options.shortSlug && slugTryCount === 1 && slug !== 'ghost-owner') {
longSlug = slug;
slug = (slug.indexOf('-') > -1) ? slug.substr(0, slug.indexOf('-')) : slug;
slug = (slug.indexOf('-') > -1) ? slug.slice(0, slug.indexOf('-')) : slug;
}
if (!_.has(options, 'importing') || !options.importing) {
@ -118,4 +118,4 @@ module.exports = function (Bookshelf) {
* @property {boolean} [importing] Set to true to don't cut the slug on import
* @property {boolean} [shortSlug] If it's a user, let's try to cut it down (unless this is a human request)
* @property {boolean} [skipDuplicateChecks] Don't append unique identifiers when the slug is not unique (this prevents any database queries)
*/
*/