extract-files
Advanced tools
Comparing version 2.1.1 to 3.0.0
# extract-files changelog | ||
## 3.0.0 | ||
* Updated dependencies. | ||
* The `extractFiles` function is now the default export. | ||
* Replace extracted files with `null` instead of deletion, fixing [#4](https://github.com/jaydenseric/extract-files/issues/4). | ||
* Simplified npm scripts. | ||
## 2.1.1 | ||
@@ -4,0 +11,0 @@ |
'use strict' | ||
exports.__esModule = true | ||
exports.extractFiles = extractFiles | ||
exports.default = extractFiles | ||
exports.ReactNativeFile = exports.isObject = void 0 | ||
@@ -35,3 +35,3 @@ | ||
}) | ||
delete node[key] | ||
node[key] = null | ||
return | ||
@@ -38,0 +38,0 @@ } |
{ | ||
"name": "extract-files", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "Reversibly extracts files from an object tree.", | ||
@@ -44,3 +44,3 @@ "license": "MIT", | ||
"eslint": "^4.15.0", | ||
"eslint-plugin-prettier": "^2.4.0", | ||
"eslint-plugin-prettier": "^2.5.0", | ||
"husky": "^0.14.3", | ||
@@ -57,6 +57,6 @@ "lint-staged": "^6.0.0", | ||
"fix": "npm run lint -- --fix && prettier --write '**/*.md'", | ||
"pretest": "npm run build", | ||
"pretest": "npm run lint && npm run build", | ||
"test": "ava lib/test.js --serial --verbose", | ||
"precommit": "lint-staged", | ||
"prepublishOnly": "npm run lint && npm run build && npm run test" | ||
"prepublishOnly": "npm run test" | ||
}, | ||
@@ -63,0 +63,0 @@ "lint-staged": { |
@@ -5,5 +5,5 @@ # extract-files | ||
Reversibly extracts files from an object tree. | ||
Reversibly extracts files from a tree object. | ||
Files are extracted along with their object path to allow reassembly. Extracted files are removed from the tree. Array item files are removed without reindexing the array to simplify reassembly. | ||
Files are extracted along with their object path to allow reassembly and are replaced with `null` in the original tree. | ||
@@ -16,10 +16,10 @@ Files may be [`File`](https://developer.mozilla.org/en/docs/Web/API/File) and [`ReactNativeFile`](https://github.com/jaydenseric/extract-files#react-native) instances. [`FileList`](https://developer.mozilla.org/en/docs/Web/API/FileList) instances are converted to arrays and the items are extracted as `File` instances. | ||
``` | ||
```shell | ||
npm install extract-files | ||
``` | ||
`extractFiles` accepts an object tree to extract files from, along with an optional tree path to prefix file paths: | ||
`extractFiles` accepts a tree object to extract files from, along with an optional tree path to prefix file paths: | ||
```js | ||
import { extractFiles } from 'extract-files' | ||
import extractFiles from 'extract-files' | ||
import tree from './tree' | ||
@@ -45,3 +45,3 @@ | ||
`extractFiles` will return an empty array if the object tree is `null` or not an object. The top tree node must not be a file. | ||
`extractFiles` will return an empty array if the tree is not an object or `null`. The tree itself must not be a file. | ||
@@ -53,3 +53,3 @@ ### React Native | ||
```js | ||
import { extractFiles, ReactNativeFile } from 'extract-files' | ||
import extractFiles, { ReactNativeFile } from 'extract-files' | ||
@@ -76,3 +76,3 @@ const tree = { | ||
const files = extractFiles(tree, 'tree') | ||
const files = extractFiles(tree) | ||
``` | ||
@@ -85,7 +85,7 @@ | ||
```js | ||
import { extractFiles } from 'extract-files' | ||
import extractFiles from 'extract-files' | ||
import objectPath from 'object-path' | ||
import tree from './tree' | ||
const files = extractFiles(tree, 'tree') | ||
const files = extractFiles(tree) | ||
const treePath = objectPath(tree) | ||
@@ -92,0 +92,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10497