Skip to content

Commit 27ffcf4

Browse files
authored
Enabling import
Added support to import the library via import statement
2 parents 5d9ab76 + 66c1a25 commit 27ffcf4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+693
-35
lines changed

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/functionality.js.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/functionality.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@ var pug = require("gulp-pug");
1111
var livereload = require("gulp-livereload");
1212
var zip = require("gulp-zip");
1313
var sourcemaps = require("gulp-sourcemaps");
14-
var browserify = require("browserify");
15-
var source = require("vinyl-source-stream");
16-
var tsify = require("tsify");
17-
var sourcemaps = require("gulp-sourcemaps");
18-
var buffer = require("vinyl-buffer");
1914

2015
// HTML Task
2116
gulp.task("html", () => {
2217
require("./server.js");
2318
return gulp
2419
.src(["./project/html/*.pug", "./project/html/pages/*.pug"])
25-
.pipe(pug({ pretty: false }))
20+
.pipe(pug({pretty: false}))
2621
.pipe(gulp.dest("./website"))
2722
.pipe(livereload());
2823
});
@@ -64,11 +59,17 @@ gulp.task("scripts", () => {
6459
.pipe(livereload());
6560
});
6661

62+
// Functionalty.js File Task
6763
// var ts = require("gulp-typescript");
6864
// var tsProject = ts.createProject("tsconfig.json");
6965

70-
// Main Library Task
7166
gulp.task("functionality", () => {
67+
var browserify = require("browserify");
68+
var source = require("vinyl-source-stream");
69+
var tsify = require("tsify");
70+
var sourcemaps = require("gulp-sourcemaps");
71+
var buffer = require("vinyl-buffer");
72+
7273
livereload.listen();
7374
require("./server.js");
7475
return browserify({
@@ -89,6 +90,13 @@ gulp.task("functionality", () => {
8990
.pipe(uglify())
9091
.pipe(gulp.dest("dist"));
9192
});
93+
gulp.task("functionality.npm-lib", () => {
94+
var ts = require("gulp-typescript");
95+
var tsProject = ts.createProject("tsconfig.npm.json");
96+
97+
livereload.listen();
98+
return tsProject.src().pipe(tsProject()).js.pipe(gulp.dest("lib"));
99+
});
92100

93101
// Compressing The Dist Folder For The User
94102
gulp.task("compress", () => {
@@ -114,5 +122,6 @@ gulp.task("watch", () => {
114122
gulp.series("scripts")
115123
);
116124

117-
gulp.watch("./project/ts/functionality/*.ts", gulp.series("functionality"));
125+
gulp.watch("./project/ts/functionality/**/*.ts", gulp.series("functionality"));
126+
gulp.watch("./project/ts/functionality/**/*.ts", gulp.series("functionality.npm-lib"));
118127
});

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {default as functionality} from './lib/main.js';
File renamed without changes.
File renamed without changes.

lib/array/filterArray.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Filter an array depending on the given value
3+
*
4+
* @param {any[]} array
5+
* @param {any} value
6+
* @returns {any[]}
7+
*/
8+
export default function filterArray(array, value) {
9+
if (!Array.isArray(array)) {
10+
throw new TypeError("Expected an array but got " + typeof array);
11+
}
12+
return array.filter((e) => e != value);
13+
}

0 commit comments

Comments
 (0)