@travetto/base
Advanced tools
Comparing version 0.0.32 to 0.0.33
@@ -22,3 +22,3 @@ { | ||
"scripts": {}, | ||
"version": "0.0.32" | ||
"version": "0.0.33" | ||
} |
import * as fs from 'fs'; | ||
let pkg = JSON.parse(fs.readFileSync(process.cwd() + '/package.json').toString()); | ||
const pkg = JSON.parse(fs.readFileSync(process.cwd() + '/package.json').toString()); | ||
@@ -5,0 +5,0 @@ export const AppInfo = { |
@@ -32,3 +32,3 @@ import * as path from 'path'; | ||
export function bulkFindSync(globs: string | string[], base?: string, exclude?: (name: string) => boolean) { | ||
let handler = findHandler(base, exclude); | ||
const handler = findHandler(base, exclude); | ||
if (!Array.isArray(globs)) { | ||
@@ -43,8 +43,8 @@ globs = [globs]; | ||
export async function bulkFind(globs: string | string[], base?: string, exclude?: (name: string) => boolean) { | ||
let handler = findHandler(base, exclude); | ||
const handler = findHandler(base, exclude); | ||
if (!Array.isArray(globs)) { | ||
globs = [globs]; | ||
} | ||
let promises = globs.map(pattern => globAsync(pattern, handler.config).then(handler.match)); | ||
let all = await Promise.all(promises); | ||
const promises = globs.map(pattern => globAsync(pattern, handler.config).then(handler.match)); | ||
const all = await Promise.all(promises); | ||
return all.reduce((acc, v) => acc.concat(v), []); | ||
@@ -60,4 +60,4 @@ } | ||
export async function bulkRead(globs: string | string[], base?: string, exclude?: (name: string) => boolean) { | ||
let files = await bulkFind(globs, base, exclude); | ||
let promises = files.map((f: string) => fsReadFileAsync(f).then(x => ({ name: f, data: x.toString() }))); | ||
const files = await bulkFind(globs, base, exclude); | ||
const promises = files.map((f: string) => fsReadFileAsync(f).then(x => ({ name: f, data: x.toString() }))); | ||
return await Promise.all(promises); | ||
@@ -67,4 +67,4 @@ } | ||
export function bulkReadSync(pattern: string, base?: string, exclude?: (name: string) => boolean) { | ||
let files = bulkFindSync(pattern, base, exclude); | ||
const files = bulkFindSync(pattern, base, exclude); | ||
return files.map(x => ({ name: x, data: fs.readFileSync(x).toString() })); | ||
} |
@@ -1,2 +0,2 @@ | ||
let e = process.env; | ||
const e = process.env; | ||
@@ -3,0 +3,0 @@ const envs = [ |
@@ -27,3 +27,3 @@ import { EventEmitter } from 'events'; | ||
let listeners = this.listeners.slice(0); | ||
const listeners = this.listeners.slice(0); | ||
this.listeners = []; | ||
@@ -41,10 +41,10 @@ | ||
let promises: Promise<any>[] = []; | ||
const promises: Promise<any>[] = []; | ||
for (let listener of listeners) { | ||
let { name, handler } = listener; | ||
for (const listener of listeners) { | ||
const { name, handler } = listener; | ||
try { | ||
console.debug(`Shutting down ${name}`); | ||
let res = handler(); | ||
const res = handler(); | ||
if (res && res.then) { | ||
@@ -51,0 +51,0 @@ promises.push(res as Promise<any>); |
@@ -19,4 +19,4 @@ import { AppEnv } from './env'; | ||
const rewrite = frames.filter(function (callSite) { | ||
let name: string = callSite.getFileName() || ''; | ||
for (let f of FILTERS) { | ||
const name: string = callSite.getFileName() || ''; | ||
for (const f of FILTERS) { | ||
if (name.includes(f)) { | ||
@@ -23,0 +23,0 @@ return false; |
@@ -46,7 +46,20 @@ { | ||
"no-duplicate-variable": true, | ||
"no-duplicate-imports": true, | ||
"no-empty": false, | ||
"no-boolean-literal-compare": true, | ||
"no-this-assignment": true, | ||
"no-import-side-effect": true, | ||
"no-eval": true, | ||
"no-for-in": true, | ||
"no-for-in-array": true, | ||
"no-inferrable-types": false, | ||
"no-string-literal": false, | ||
"no-exec-script": true, | ||
"no-string-throw": true, | ||
"no-shadowed-variable": true, | ||
"no-string-literal": false, | ||
"no-single-line-block-comment": true, | ||
"no-sparse-arrays": true, | ||
"no-stateless-class": false, | ||
"no-reserved-keywords": true, | ||
"no-suspicious-comment": true, | ||
"no-switch-case-fall-through": true, | ||
@@ -58,2 +71,8 @@ "no-trailing-whitespace": true, | ||
"no-var-keyword": true, | ||
"object-literal-shorthand": true, | ||
"object-literal-key-quotes": [ | ||
true, | ||
"as-needed" | ||
], | ||
"prefer-array-literal": true, | ||
"object-literal-sort-keys": false, | ||
@@ -67,2 +86,3 @@ "one-line": [ | ||
], | ||
"prefer-const": true, | ||
"quotemark": [ | ||
@@ -69,0 +89,0 @@ true, |
11422
354