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:
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.
|
||||
// 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 %>/'
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
*/
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue