Use ES6 import/export (#139)

* Use ES6 import/export

* Fix tests
This commit is contained in:
Jaco Greeff
2018-06-20 16:36:07 +02:00
committed by GitHub
parent 7a694c075c
commit 99b86d9849
263 changed files with 841 additions and 814 deletions
+4 -4
View File
@@ -3,8 +3,8 @@
// of the ISC license. See the LICENSE file for details.
// @flow
const isNull = require('../is/null');
const isUndefined = require('../is/undefined');
import isNull from '../is/null';
import isUndefined from '../is/undefined';
/**
@name arrayFilter
@@ -18,8 +18,8 @@ const isUndefined = require('../is/undefined');
arrayFilter([0, void 0, true, null, false, '']); // [0, true, null, false, '']
arrayFilter([0, void 0, true, null, false, ''], false); // [0, true, false, '']
*/
module.exports = function arrayFilter (array: Array<mixed>, allowNulls: boolean = true): Array<mixed> {
export default function arrayFilter (array: Array<mixed>, allowNulls: boolean = true): Array<mixed> {
return array.filter((value) => {
return !isUndefined(value) && (allowNulls || !isNull(value));
});
};
}
+1 -1
View File
@@ -2,7 +2,7 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
const { arrayFilter } = require('./index');
import { arrayFilter } from './index';
describe('filterArray', () => {
it('filters arrays, removing undefined', () => {
+2 -2
View File
@@ -3,11 +3,11 @@
// of the ISC license. See the LICENSE file for details.
// @flow
const arrayFilter = require('./filter');
import arrayFilter from './filter';
/**
@summary Utility methods that operates on arrays
*/
module.exports = {
export {
arrayFilter
};