schemaglobin
Advanced tools
Comparing version 4.4.0 to 4.5.0
@@ -0,1 +1,3 @@ | ||
/** Is a value an array? */ | ||
export declare const isArray: <T extends unknown[]>(v: unknown) => v is T; | ||
/** | ||
@@ -34,3 +36,7 @@ * Break an array into equal sized chunks (last chunk might be smaller). | ||
export declare const prevItem: <T>(arr: readonly T[], value: T) => T | undefined; | ||
/** Return a shuffled version of an array. */ | ||
/** | ||
* Return a shuffled version of an array. | ||
* - Uses Fisher Yates algorithm. | ||
* @returns Copy of the input array in a random order. | ||
*/ | ||
export declare const shuffle: <T>(input: readonly T[]) => readonly T[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.shuffle = exports.prevItem = exports.nextItem = exports.replaceItem = exports.removeItem = exports.addItem = exports.toggleItem = exports.arrayChunk = void 0; | ||
exports.shuffle = exports.prevItem = exports.nextItem = exports.replaceItem = exports.removeItem = exports.addItem = exports.toggleItem = exports.arrayChunk = exports.isArray = void 0; | ||
/** Is a value an array? */ | ||
exports.isArray = (v) => v instanceof Array; | ||
/** | ||
@@ -64,3 +66,7 @@ * Break an array into equal sized chunks (last chunk might be smaller). | ||
}; | ||
/** Return a shuffled version of an array. */ | ||
/** | ||
* Return a shuffled version of an array. | ||
* - Uses Fisher Yates algorithm. | ||
* @returns Copy of the input array in a random order. | ||
*/ | ||
exports.shuffle = (input) => { | ||
@@ -67,0 +73,0 @@ const r = input.slice(); |
@@ -0,1 +1,3 @@ | ||
/** Is a value a date? */ | ||
export declare const isDate: (v: unknown) => v is Date; | ||
/** Things that can be converted to dates. */ | ||
@@ -2,0 +4,0 @@ export declare type PossibleDate = Date | number | string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatDate = exports.formatAgo = exports.formatUntil = exports.formatWhen = exports.weeksAgo = exports.weeksUntil = exports.daysAgo = exports.daysUntil = exports.secondsAgo = exports.secondsUntil = exports.addHours = exports.addDays = exports.getMonday = exports.getMidnight = exports.getDow = exports.days = exports.getYmd = exports.makeDate = void 0; | ||
exports.formatDate = exports.formatAgo = exports.formatUntil = exports.formatWhen = exports.weeksAgo = exports.weeksUntil = exports.daysAgo = exports.daysUntil = exports.secondsAgo = exports.secondsUntil = exports.addHours = exports.addDays = exports.getMonday = exports.getMidnight = exports.getDow = exports.days = exports.getYmd = exports.makeDate = exports.isDate = void 0; | ||
/** Is a value a date? */ | ||
exports.isDate = (v) => v instanceof Date; | ||
exports.makeDate = (date) => (date instanceof Date ? date : new Date(date)); | ||
@@ -5,0 +7,0 @@ /** Convert a `Date()` instance to a YMD string like "2015-09-12" */ |
@@ -0,1 +1,3 @@ | ||
/** Is a value a number? */ | ||
export declare const isNumber: (v: unknown) => v is number; | ||
/** | ||
@@ -2,0 +4,0 @@ * Convert a stringy number into a number. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatNumber = exports.roundToStep = exports.stringToNumber = void 0; | ||
exports.formatNumber = exports.roundToStep = exports.stringToNumber = exports.isNumber = void 0; | ||
/** Is a value a number? */ | ||
exports.isNumber = (v) => typeof v === "number"; | ||
/** | ||
@@ -5,0 +7,0 @@ * Convert a stringy number into a number. |
@@ -0,1 +1,3 @@ | ||
/** Is a value a string? */ | ||
export declare const isString: (v: unknown) => v is string; | ||
/** | ||
@@ -2,0 +4,0 @@ * A titleable item is anything that can easily be converted to a string, including: |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSlug = exports.getTitle = void 0; | ||
exports.getSlug = exports.getTitle = exports.isString = void 0; | ||
const number_1 = require("./number"); | ||
const date_1 = require("./date"); | ||
/** Is a value a string? */ | ||
exports.isString = (v) => typeof v === "string"; | ||
/** Turn any value into its title string equivalent. */ | ||
@@ -7,0 +9,0 @@ exports.getTitle = (value) => { |
@@ -17,5 +17,7 @@ export * from "./types"; | ||
export * from "./helpers/array"; | ||
export * from "./helpers/boolean"; | ||
export * from "./helpers/date"; | ||
export * from "./helpers/distance"; | ||
export * from "./helpers/invalid"; | ||
export * from "./helpers/null"; | ||
export * from "./helpers/number"; | ||
@@ -25,2 +27,3 @@ export * from "./helpers/object"; | ||
export * from "./helpers/string"; | ||
export * from "./helpers/undefined"; | ||
export * from "./helpers/url"; |
@@ -33,5 +33,7 @@ "use strict"; | ||
__exportStar(require("./helpers/array"), exports); | ||
__exportStar(require("./helpers/boolean"), exports); | ||
__exportStar(require("./helpers/date"), exports); | ||
__exportStar(require("./helpers/distance"), exports); | ||
__exportStar(require("./helpers/invalid"), exports); | ||
__exportStar(require("./helpers/null"), exports); | ||
__exportStar(require("./helpers/number"), exports); | ||
@@ -41,2 +43,3 @@ __exportStar(require("./helpers/object"), exports); | ||
__exportStar(require("./helpers/string"), exports); | ||
__exportStar(require("./helpers/undefined"), exports); | ||
__exportStar(require("./helpers/url"), exports); |
{ | ||
"name": "schemaglobin", | ||
"description": "Validate user-entered data.", | ||
"version": "4.4.0", | ||
"version": "4.5.0", | ||
"repository": "https://github.com/dhoulb/schemaglobin", | ||
@@ -30,14 +30,14 @@ "author": "Dave Houlbrooke <dave@shax.com>", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.0", | ||
"@typescript-eslint/eslint-plugin": "^3.3.0", | ||
"@typescript-eslint/parser": "^3.3.0", | ||
"eslint": "^7.2.0", | ||
"@types/jest": "^26.0.5", | ||
"@typescript-eslint/eslint-plugin": "^3.7.0", | ||
"@typescript-eslint/parser": "^3.7.0", | ||
"eslint": "^7.5.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.21.2", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"jest": "^26.0.1", | ||
"jest": "^26.1.0", | ||
"prettier": "^2.0.5", | ||
"ts-jest": "^26.1.0", | ||
"typescript": "^3.9.5" | ||
"ts-jest": "^26.1.3", | ||
"typescript": "^3.9.7" | ||
} | ||
} |
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
137167
59
2524