mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 12:20:40 -07:00
This commit is contained in:
+7
-1
@@ -1,5 +1,5 @@
|
||||
import * as _ from '../util/underscore'
|
||||
import { resolve as nodeResolve, extname, dirname as nodeDirname } from 'path'
|
||||
import { sep, resolve as nodeResolve, extname, dirname as nodeDirname } from 'path'
|
||||
import { stat, statSync, readFile as nodeReadFile, readFileSync as nodeReadFileSync } from 'fs'
|
||||
|
||||
const statAsync = _.promisify(stat)
|
||||
@@ -39,4 +39,10 @@ export function fallback (file: string) {
|
||||
export function dirname (filepath: string) {
|
||||
return nodeDirname(filepath)
|
||||
}
|
||||
export function contains (root: string, file: string) {
|
||||
root = nodeResolve(root)
|
||||
root = root.endsWith(sep) ? root : root + sep
|
||||
return file.startsWith(root)
|
||||
}
|
||||
|
||||
export { sep } from 'path'
|
||||
|
||||
Reference in New Issue
Block a user