feat: full syntax for strftime, close #177

- strftime syntax: <flags><width><modifier><conversion>
- new conversions: %n, %t
- fixed conversions: %N
- flags: _ ^ - 0 # :
- modifiers: E, O (ignored)
This commit is contained in:
harttle
2019-12-15 02:28:33 +00:00
parent c69ad538d4
commit ba5ff3f41c
7 changed files with 368 additions and 253 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { Expression } from '../../render/expression'
import { Context } from '../../context/context'
import { isArray } from '../../util/underscore'
import { isArray, identify } from '../../util/underscore'
import { FilterImplOptions } from './filter-impl-options'
type KeyValuePair = [string?, string?]
@@ -18,7 +18,7 @@ export class Filter {
if (!impl && strictFilters) throw new TypeError(`undefined filter: ${name}`)
this.name = name
this.impl = impl || (x => x)
this.impl = impl || identify
this.args = args
}
public * render (value: any, context: Context) {