Download code/test/JavaScript/0004472_fuzzify.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 625 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/test/JavaScript/0004472_fuzzify.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/code/test/JavaScript/0004472_fuzzify.js
-
curl -L -o 0004472_fuzzify.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/test/JavaScript/0004472_fuzzify.js
625 Bytes
| /* Copyright 2017 Ronny Reichmann */ | |
| /* FUZZIFY Adjectify value ranges for later use in pattern matching */ | |
| function composeCheckFn (compareFn, adjective) { | |
| return nextCheckFn => { | |
| return value => { | |
| if (compareFn(value)) return adjective | |
| else return nextCheckFn(value) | |
| } | |
| } | |
| } | |
| function fuzzify (config) { | |
| const initializers = Object.keys(config) | |
| .map(adjective => { | |
| const compareFn = config[adjective] | |
| return composeCheckFn(compareFn, adjective) | |
| }) | |
| initializers.reverse() | |
| return initializers.reduce((acc, initCheckFn) => initCheckFn(acc), v => v) | |
| } | |
| module.exports = fuzzify | |