mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36: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:
parent
aacb30e35e
commit
adc0805dce
3 changed files with 4 additions and 4 deletions
|
@ -337,7 +337,7 @@ module.exports = function (grunt) {
|
||||||
// A list of files and patterns to include when creating a release zip.
|
// 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
|
// 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) {
|
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 %>/'
|
dest: '<%= paths.releaseBuild %>/'
|
||||||
});
|
});
|
||||||
|
|
|
@ -80,7 +80,7 @@ function resolvePaths(globals, data, value) {
|
||||||
path = path.replace(/\.\[/g, '[');
|
path = path.replace(/\.\[/g, '[');
|
||||||
|
|
||||||
if (path.charAt(0) === '@') {
|
if (path.charAt(0) === '@') {
|
||||||
result = jsonpath.query(globals, path.substr(1));
|
result = jsonpath.query(globals, path.slice(1));
|
||||||
} else {
|
} else {
|
||||||
// Do the query, which always returns an array of matches
|
// Do the query, which always returns an array of matches
|
||||||
result = jsonpath.query(data, path);
|
result = jsonpath.query(data, path);
|
||||||
|
|
|
@ -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 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') {
|
if (baseName === 'user' && options && options.shortSlug && slugTryCount === 1 && slug !== 'ghost-owner') {
|
||||||
longSlug = slug;
|
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) {
|
if (!_.has(options, 'importing') || !options.importing) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue