Closed ozcan-durak closed 3 weeks ago
On windows file listing having double slash on object return list. Is there any way to avoid it ?
.normalise() is not working on this case.
.normalise()
Currently using.
Object.replaceAll = function (entity, needle, replacement, affectsKeys, affectsValues) { affectsKeys = typeof affectsKeys === "undefined" ? true : affectsKeys; affectsValues = typeof affectsValues === "undefined" ? true : affectsValues; var newEntity = {}, regExp = new RegExp( needle, 'g' ); for( var property in entity ) { if( !entity.hasOwnProperty( property ) ) { continue; } var value = entity[property], newProperty = property; if( affectsKeys ) { newProperty = property.replace( regExp, replacement ); } if( affectsValues ) { if( typeof value === "object" ) { value = Object.replaceAll( value, needle, replacement, affectsKeys, affectsValues ); } else if( typeof value === "string" ) { value = value.replace( regExp, replacement ); } } newEntity[newProperty] = value; } return newEntity; };
var replaced = Object.replaceAll( files, /\\/g, "/" );
you can avoid it using the withPathSeparator method with '/'
'/'
On windows file listing having double slash on object return list. Is there any way to avoid it ?
.normalise()
is not working on this case.Currently using.
var replaced = Object.replaceAll( files, /\\/g, "/" );