Cannot call method 'slice' of undefined

When the class of `packageData` is `String`, then usage like below:

```
if (!packageData.files) {
    packageData.files = [];
    console.log(packageData.files); // we still got undefined here.
}
```
actually does not work. 

`files = packageData.files.slice(0);` would cause error 'Cannot call method 'slice' of undefined'.