-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples,lib,test: switch to code rewrite
For more information see: #935
- Loading branch information
Showing
129 changed files
with
24,519 additions
and
5,466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const RULES_DIR = path.join(__dirname, 'rules'); | ||
|
||
let cache; | ||
module.exports = { | ||
get rules() { | ||
if (!cache) { | ||
cache = {}; | ||
const files = fs.readdirSync(RULES_DIR) | ||
.filter(filename => filename.endsWith('.js')); | ||
for (const file of files) { | ||
const name = file.slice(0, -3); | ||
cache[name] = require(path.resolve(RULES_DIR, file)); | ||
} | ||
} | ||
return cache; | ||
}, | ||
}; |
Oops, something went wrong.