Add ramda
This commit is contained in:
parent
bf1e55c0dc
commit
f4f1ea6572
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
|
||||
test.html
|
||||
node_modules/
|
||||
|
16
dist/ffnm.min.js
vendored
16
dist/ffnm.min.js
vendored
@ -12,13 +12,15 @@ var EVENTS;
|
||||
// FUNCTIONS
|
||||
//===
|
||||
function validateSyntax() {
|
||||
// Check every event
|
||||
var eventsKeys = Object.keys(EVENTS).filter(function (key) { return !isNaN(Number(EVENTS[key])); });
|
||||
eventsKeys.forEach(function (event) {
|
||||
var ddd = document.querySelector("[" + event + "]").length;
|
||||
console.log(ddd);
|
||||
});
|
||||
return true;
|
||||
// Get every items from EVENTS
|
||||
var eventsKeys = R.filter(function (key) { return !isNaN(Number(EVENTS[key])); }, Object.keys(EVENTS));
|
||||
// Check all event syntax
|
||||
return eventsKeys.map(function (event) {
|
||||
return R.map(function (element) {
|
||||
console.log(element.getAttribute(event));
|
||||
return /^${event}/.test(element.getAttribute(event));
|
||||
}, document.querySelectorAll("[" + event + "]")).every(function (item) { return item; });
|
||||
}).every(function (event) { return event; });
|
||||
}
|
||||
//===
|
||||
// LINTER
|
||||
|
11
package-lock.json
generated
Normal file
11
package-lock.json
generated
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"@types/ramda": {
|
||||
"version": "github:types/npm-ramda#9529aa3c8ff70ff84afcbc0be83443c00f30ea90",
|
||||
"from": "github:types/npm-ramda#dist",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
18
src/core.ts
18
src/core.ts
@ -1,3 +1,4 @@
|
||||
|
||||
//===
|
||||
// VARIABLES
|
||||
//===
|
||||
@ -8,13 +9,16 @@ enum EVENTS {'i-click', 'i-scroll-up', 'i-scroll-down', 'i-hover'}
|
||||
//===
|
||||
function validateSyntax(): boolean {
|
||||
|
||||
// Check every event
|
||||
let eventsKeys = Object.keys(EVENTS).filter(key => !isNaN(Number(EVENTS[key])));
|
||||
eventsKeys.forEach((event) => {
|
||||
let ddd = document.querySelector(`[${event}]`).length
|
||||
console.log(ddd)
|
||||
})
|
||||
return true
|
||||
// Get every items from EVENTS
|
||||
let eventsKeys: string[] = R.filter(key => !isNaN(Number(EVENTS[key])), Object.keys(EVENTS));
|
||||
|
||||
// Check all event syntax
|
||||
return eventsKeys.map((event) => {
|
||||
return R.map((element) => {
|
||||
console.log(element.getAttribute(event))
|
||||
return /^${event}/.test(element.getAttribute(event))
|
||||
}, document.querySelectorAll(`[${event}]`)).every(item => item)
|
||||
}).every(event => event)
|
||||
}
|
||||
|
||||
|
||||
|
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom",
|
||||
"dom.iterable"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user