chore(project): es6ify source code

* use ES6 import / export
* UTILS: export individual utilities
* TESTS: localize TestHelper includes

BREAKING CHANGE:

* all utilities export independent functions
* library sources got ported to ES6. You must now use
  a ES module bundler such as Browserify + babelify or
  Webpack to consume this library (or parts of it).
This commit is contained in:
Nico Rehwaldt
2018-04-02 21:01:53 +02:00
parent 56a644177d
commit d3449ca87c
224 changed files with 2635 additions and 1932 deletions

View File

@ -1,8 +1,10 @@
'use strict';
var some = require('min-dash').some;
import {
some
} from 'min-dash';
var is = require('../../../util/ModelUtil').is;
import { is } from '../../../util/ModelUtil';
/**
@ -13,14 +15,12 @@ var is = require('../../../util/ModelUtil').is;
*
* @return {Boolean}
*/
function isAny(element, types) {
export function isAny(element, types) {
return some(types, function(t) {
return is(element, t);
});
}
module.exports.isAny = isAny;
/**
* Return the parent of the element with any of the given types.
@ -30,7 +30,7 @@ module.exports.isAny = isAny;
*
* @return {djs.model.Base}
*/
function getParent(element, anyType) {
export function getParent(element, anyType) {
if (typeof anyType === 'string') {
anyType = [ anyType ];
@ -43,6 +43,4 @@ function getParent(element, anyType) {
}
return null;
}
module.exports.getParent = getParent;
}