Add ramda
This commit is contained in:
parent
bf1e55c0dc
commit
f4f1ea6572
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
|
|
||||||
test.html
|
test.html
|
||||||
|
node_modules/
|
||||||
|
16
dist/ffnm.min.js
vendored
16
dist/ffnm.min.js
vendored
@ -12,13 +12,15 @@ var EVENTS;
|
|||||||
// FUNCTIONS
|
// FUNCTIONS
|
||||||
//===
|
//===
|
||||||
function validateSyntax() {
|
function validateSyntax() {
|
||||||
// Check every event
|
// Get every items from EVENTS
|
||||||
var eventsKeys = Object.keys(EVENTS).filter(function (key) { return !isNaN(Number(EVENTS[key])); });
|
var eventsKeys = R.filter(function (key) { return !isNaN(Number(EVENTS[key])); }, Object.keys(EVENTS));
|
||||||
eventsKeys.forEach(function (event) {
|
// Check all event syntax
|
||||||
var ddd = document.querySelector("[" + event + "]").length;
|
return eventsKeys.map(function (event) {
|
||||||
console.log(ddd);
|
return R.map(function (element) {
|
||||||
});
|
console.log(element.getAttribute(event));
|
||||||
return true;
|
return /^${event}/.test(element.getAttribute(event));
|
||||||
|
}, document.querySelectorAll("[" + event + "]")).every(function (item) { return item; });
|
||||||
|
}).every(function (event) { return event; });
|
||||||
}
|
}
|
||||||
//===
|
//===
|
||||||
// LINTER
|
// 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
|
// VARIABLES
|
||||||
//===
|
//===
|
||||||
@ -8,13 +9,16 @@ enum EVENTS {'i-click', 'i-scroll-up', 'i-scroll-down', 'i-hover'}
|
|||||||
//===
|
//===
|
||||||
function validateSyntax(): boolean {
|
function validateSyntax(): boolean {
|
||||||
|
|
||||||
// Check every event
|
// Get every items from EVENTS
|
||||||
let eventsKeys = Object.keys(EVENTS).filter(key => !isNaN(Number(EVENTS[key])));
|
let eventsKeys: string[] = R.filter(key => !isNaN(Number(EVENTS[key])), Object.keys(EVENTS));
|
||||||
eventsKeys.forEach((event) => {
|
|
||||||
let ddd = document.querySelector(`[${event}]`).length
|
// Check all event syntax
|
||||||
console.log(ddd)
|
return eventsKeys.map((event) => {
|
||||||
})
|
return R.map((element) => {
|
||||||
return true
|
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