@thi.ng/strings
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -23,3 +23,3 @@ import { memoizeJ } from "@thi.ng/memoize"; | ||
export const center = memoizeJ((n, pad = " ") => { | ||
const buf = repeat(pad, n); | ||
const buf = repeat(String(pad), n); | ||
return (x) => { | ||
@@ -26,0 +26,0 @@ if (x == null) |
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.1.3...@thi.ng/strings@1.2.0) (2019-07-07) | ||
### Features | ||
* **strings:** enable TS strict compiler flags (refactor) ([76cecb8](https://github.com/thi-ng/umbrella/commit/76cecb8)) | ||
## [1.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/strings@1.1.2...@thi.ng/strings@1.1.3) (2019-05-22) | ||
@@ -8,0 +19,0 @@ |
@@ -21,3 +21,3 @@ 'use strict'; | ||
const center = memoize.memoizeJ((n, pad = " ") => { | ||
const buf = repeat(pad, n); | ||
const buf = repeat(String(pad), n); | ||
return (x) => { | ||
@@ -37,3 +37,3 @@ if (x == null) | ||
const padLeft = memoize.memoizeJ((n, ch = " ") => { | ||
const buf = repeat(ch, n); | ||
const buf = repeat(String(ch), n); | ||
return (x) => x != null | ||
@@ -86,3 +86,3 @@ ? ((x = x.toString()), x.length < n ? buf.substr(x.length) + x : x) | ||
const padRight = memoize.memoizeJ((n, ch = " ") => { | ||
const buf = repeat(ch, n); | ||
const buf = repeat(String(ch), n); | ||
return (x) => x != null | ||
@@ -155,3 +155,7 @@ ? ((x = x.toString()), x.length < n ? x + buf.substr(x.length) : x) | ||
const groups = exp | ||
.map((x) => [x[0], x[2] != null ? x[2] : prec, x[1]]) | ||
.map((x) => [ | ||
x[0], | ||
x[2] != null ? x[2] : prec, | ||
x[1] | ||
]) | ||
.sort((a, b) => a[0] - b[0]); | ||
@@ -169,2 +173,3 @@ return (x) => { | ||
} | ||
return ""; | ||
}; | ||
@@ -171,0 +176,0 @@ }); |
@@ -20,3 +20,3 @@ (function (global, factory) { | ||
const center = memoize.memoizeJ((n, pad = " ") => { | ||
const buf = repeat(pad, n); | ||
const buf = repeat(String(pad), n); | ||
return (x) => { | ||
@@ -36,3 +36,3 @@ if (x == null) | ||
const padLeft = memoize.memoizeJ((n, ch = " ") => { | ||
const buf = repeat(ch, n); | ||
const buf = repeat(String(ch), n); | ||
return (x) => x != null | ||
@@ -85,3 +85,3 @@ ? ((x = x.toString()), x.length < n ? buf.substr(x.length) + x : x) | ||
const padRight = memoize.memoizeJ((n, ch = " ") => { | ||
const buf = repeat(ch, n); | ||
const buf = repeat(String(ch), n); | ||
return (x) => x != null | ||
@@ -154,3 +154,7 @@ ? ((x = x.toString()), x.length < n ? x + buf.substr(x.length) : x) | ||
const groups = exp | ||
.map((x) => [x[0], x[2] != null ? x[2] : prec, x[1]]) | ||
.map((x) => [ | ||
x[0], | ||
x[2] != null ? x[2] : prec, | ||
x[1] | ||
]) | ||
.sort((a, b) => a[0] - b[0]); | ||
@@ -168,2 +172,3 @@ return (x) => { | ||
} | ||
return ""; | ||
}; | ||
@@ -170,0 +175,0 @@ }); |
{ | ||
"name": "@thi.ng/strings", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "Various string formatting & utility functions", | ||
@@ -28,11 +28,11 @@ "module": "./index.js", | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^11.13.7", | ||
"@types/node": "^12.0.8", | ||
"mocha": "^6.1.4", | ||
"nyc": "^14.0.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.4.5" | ||
"typescript": "^3.5.2" | ||
}, | ||
"dependencies": { | ||
"@thi.ng/errors": "^1.0.6", | ||
"@thi.ng/memoize": "^1.0.9" | ||
"@thi.ng/errors": "^1.1.0", | ||
"@thi.ng/memoize": "^1.1.0" | ||
}, | ||
@@ -64,3 +64,3 @@ "keywords": [ | ||
"sideEffects": false, | ||
"gitHead": "5a4226d52724f320fb25656f08addb2825375fee" | ||
"gitHead": "efa9fdd61dd4ad2187cefe0a26df3bf2baade24b" | ||
} |
@@ -8,3 +8,3 @@ import { memoizeJ } from "@thi.ng/memoize"; | ||
export const padLeft = memoizeJ((n, ch = " ") => { | ||
const buf = repeat(ch, n); | ||
const buf = repeat(String(ch), n); | ||
return (x) => x != null | ||
@@ -11,0 +11,0 @@ ? ((x = x.toString()), x.length < n ? buf.substr(x.length) + x : x) |
@@ -8,3 +8,3 @@ import { memoizeJ } from "@thi.ng/memoize"; | ||
export const padRight = memoizeJ((n, ch = " ") => { | ||
const buf = repeat(ch, n); | ||
const buf = repeat(String(ch), n); | ||
return (x) => x != null | ||
@@ -11,0 +11,0 @@ ? ((x = x.toString()), x.length < n ? x + buf.substr(x.length) : x) |
import { Stringer } from "./api"; | ||
export declare const units: (exp: [number, string, number?][], base: string, prec?: number) => Stringer<number>; | ||
declare type UnitDefs = [number, string, number?][]; | ||
export declare const units: (exp: UnitDefs, base: string, prec?: number) => Stringer<number>; | ||
export declare const bits: Stringer<number>; | ||
@@ -8,1 +9,2 @@ export declare const bytes: Stringer<number>; | ||
export declare const grams: Stringer<number>; | ||
export {}; |
import { memoizeJ } from "@thi.ng/memoize"; | ||
export const units = memoizeJ((exp, base, prec = 2) => { | ||
const groups = exp | ||
.map((x) => [x[0], x[2] != null ? x[2] : prec, x[1]]) | ||
.map((x) => [ | ||
x[0], | ||
x[2] != null ? x[2] : prec, | ||
x[1] | ||
]) | ||
.sort((a, b) => a[0] - b[0]); | ||
@@ -17,2 +21,3 @@ return (x) => { | ||
} | ||
return ""; | ||
}; | ||
@@ -19,0 +24,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73502
1088
Updated@thi.ng/errors@^1.1.0
Updated@thi.ng/memoize@^1.1.0