@poppinss/utils 5.0.0 → 6.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +661 -873
- package/build/index.d.ts +16 -10
- package/build/index.js +21 -53
- package/build/lodash/main.cjs +37 -0
- package/build/src/{Helpers/base64.d.ts → base64.d.ts} +7 -23
- package/build/src/{Helpers/base64.js → base64.js} +9 -22
- package/build/src/{Helpers/compose.d.ts → compose.d.ts} +0 -11
- package/build/src/compose.js +3 -0
- package/build/src/{defineStaticProperty.d.ts → define_static_property.d.ts} +2 -6
- package/build/src/define_static_property.js +21 -0
- package/build/src/exception.d.ts +16 -0
- package/build/src/exception.js +29 -0
- package/build/src/flatten.d.ts +1 -1
- package/build/src/flatten.js +4 -13
- package/build/src/fs_import_all.d.ts +3 -0
- package/build/src/fs_import_all.js +28 -0
- package/build/src/fs_read_all.d.ts +3 -0
- package/build/src/fs_read_all.js +55 -0
- package/build/src/is_script_file.d.ts +1 -0
- package/build/src/is_script_file.js +12 -0
- package/build/src/json/main.d.ts +7 -0
- package/build/src/json/main.js +6 -0
- package/build/src/json/safe_parse.d.ts +2 -0
- package/build/src/json/safe_parse.js +7 -0
- package/build/src/json/safe_stringify.d.ts +2 -0
- package/build/src/json/safe_stringify.js +18 -0
- package/build/src/message_builder.d.ts +5 -0
- package/build/src/message_builder.js +43 -0
- package/build/src/natural_sort.d.ts +1 -0
- package/build/src/natural_sort.js +3 -0
- package/build/src/object_builder.d.ts +10 -0
- package/build/src/object_builder.js +31 -0
- package/build/src/{Helpers/safeEqual.d.ts → safe_equal.d.ts} +1 -4
- package/build/src/safe_equal.js +14 -0
- package/build/src/slash.d.ts +1 -5
- package/build/src/slash.js +1 -24
- package/build/src/string/bytes.d.ts +6 -0
- package/build/src/string/bytes.js +12 -0
- package/build/src/string/change_case.d.ts +13 -0
- package/build/src/string/change_case.js +75 -0
- package/build/src/string/excerpt.d.ts +4 -0
- package/build/src/string/excerpt.js +10 -0
- package/build/src/string/interpolate.d.ts +1 -0
- package/build/src/{Helpers → string}/interpolate.js +1 -22
- package/build/src/string/main.d.ts +46 -0
- package/build/src/string/main.js +42 -0
- package/build/src/string/milliseconds.d.ts +5 -0
- package/build/src/string/milliseconds.js +16 -0
- package/build/src/string/ordinal.d.ts +1 -0
- package/build/src/string/ordinal.js +21 -0
- package/build/src/string/pluralize.d.ts +12 -0
- package/build/src/string/pluralize.js +12 -0
- package/build/src/string/random.d.ts +1 -0
- package/build/src/string/random.js +7 -0
- package/build/src/string/seconds.d.ts +5 -0
- package/build/src/string/seconds.js +16 -0
- package/build/src/string/slugify.d.ts +2 -0
- package/build/src/string/slugify.js +2 -0
- package/build/src/string/to_sentence.d.ts +5 -0
- package/build/src/string/to_sentence.js +13 -0
- package/build/src/string/truncate.d.ts +4 -0
- package/build/src/string/truncate.js +10 -0
- package/build/src/types.d.ts +14 -0
- package/build/src/types.js +1 -0
- package/lodash/lodash.types.d.ts +44 -0
- package/package.json +70 -82
- package/build/helpers.d.ts +0 -1
- package/build/helpers.js +0 -25
- package/build/src/Exception.d.ts +0 -17
- package/build/src/Exception.js +0 -68
- package/build/src/Helpers/MessageBuilder.d.ts +0 -28
- package/build/src/Helpers/MessageBuilder.js +0 -97
- package/build/src/Helpers/ObjectBuilder.d.ts +0 -46
- package/build/src/Helpers/ObjectBuilder.js +0 -75
- package/build/src/Helpers/compose.js +0 -15
- package/build/src/Helpers/fsReadAll.d.ts +0 -4
- package/build/src/Helpers/fsReadAll.js +0 -23
- package/build/src/Helpers/index.d.ts +0 -14
- package/build/src/Helpers/index.js +0 -62
- package/build/src/Helpers/interpolate.d.ts +0 -7
- package/build/src/Helpers/requireAll.d.ts +0 -8
- package/build/src/Helpers/requireAll.js +0 -65
- package/build/src/Helpers/resolveDir.d.ts +0 -5
- package/build/src/Helpers/resolveDir.js +0 -46
- package/build/src/Helpers/resolveFrom.d.ts +0 -5
- package/build/src/Helpers/resolveFrom.js +0 -27
- package/build/src/Helpers/safeEqual.js +0 -42
- package/build/src/Helpers/string.d.ts +0 -124
- package/build/src/Helpers/string.js +0 -328
- package/build/src/Helpers/types.d.ts +0 -86
- package/build/src/Helpers/types.js +0 -161
- package/build/src/ManagerConfigValidator.d.ts +0 -20
- package/build/src/ManagerConfigValidator.js +0 -55
- package/build/src/defineStaticProperty.js +0 -57
- package/build/src/esmRequire.d.ts +0 -5
- package/build/src/esmRequire.js +0 -20
- package/build/src/esmResolver.d.ts +0 -1
- package/build/src/esmResolver.js +0 -15
- package/build/src/fast-safe-stringify.d.ts +0 -2
- package/build/src/fast-safe-stringify.js +0 -101
- package/build/src/isScriptFile.d.ts +0 -5
- package/build/src/isScriptFile.js +0 -28
- package/build/src/lodash.d.ts +0 -13
- package/build/src/lodash.js +0 -39
- package/build/src/safeParse.d.ts +0 -5
- package/build/src/safeParse.js +0 -42
- package/build/src/safeStringify.d.ts +0 -5
- package/build/src/safeStringify.js +0 -39
- package/types/lodash.types.d.ts +0 -65
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @poppinss/utils
|
|
4
|
-
*
|
|
5
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
-
}
|
|
16
|
-
Object.defineProperty(o, k2, desc);
|
|
17
|
-
}) : (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
o[k2] = m[k];
|
|
20
|
-
}));
|
|
21
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
-
}) : function(o, v) {
|
|
24
|
-
o["default"] = v;
|
|
25
|
-
});
|
|
26
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
27
|
-
if (mod && mod.__esModule) return mod;
|
|
28
|
-
var result = {};
|
|
29
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
30
|
-
__setModuleDefault(result, mod);
|
|
31
|
-
return result;
|
|
32
|
-
};
|
|
33
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
34
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
|
-
};
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.types = exports.string = exports.safeEqual = exports.resolveFrom = exports.resolveDir = exports.requireAll = exports.ObjectBuilder = exports.MessageBuilder = exports.interpolate = exports.fsReadAll = exports.compose = exports.base64 = exports.file = exports.cuid = void 0;
|
|
38
|
-
var cuid_1 = require("cuid");
|
|
39
|
-
Object.defineProperty(exports, "cuid", { enumerable: true, get: function () { return __importDefault(cuid_1).default; } });
|
|
40
|
-
exports.file = __importStar(require("@poppinss/file-generator"));
|
|
41
|
-
var base64_1 = require("./base64");
|
|
42
|
-
Object.defineProperty(exports, "base64", { enumerable: true, get: function () { return base64_1.base64; } });
|
|
43
|
-
var compose_1 = require("./compose");
|
|
44
|
-
Object.defineProperty(exports, "compose", { enumerable: true, get: function () { return compose_1.compose; } });
|
|
45
|
-
var fsReadAll_1 = require("./fsReadAll");
|
|
46
|
-
Object.defineProperty(exports, "fsReadAll", { enumerable: true, get: function () { return fsReadAll_1.fsReadAll; } });
|
|
47
|
-
var interpolate_1 = require("./interpolate");
|
|
48
|
-
Object.defineProperty(exports, "interpolate", { enumerable: true, get: function () { return interpolate_1.interpolate; } });
|
|
49
|
-
var MessageBuilder_1 = require("./MessageBuilder");
|
|
50
|
-
Object.defineProperty(exports, "MessageBuilder", { enumerable: true, get: function () { return MessageBuilder_1.MessageBuilder; } });
|
|
51
|
-
var ObjectBuilder_1 = require("./ObjectBuilder");
|
|
52
|
-
Object.defineProperty(exports, "ObjectBuilder", { enumerable: true, get: function () { return ObjectBuilder_1.ObjectBuilder; } });
|
|
53
|
-
var requireAll_1 = require("./requireAll");
|
|
54
|
-
Object.defineProperty(exports, "requireAll", { enumerable: true, get: function () { return requireAll_1.requireAll; } });
|
|
55
|
-
var resolveDir_1 = require("./resolveDir");
|
|
56
|
-
Object.defineProperty(exports, "resolveDir", { enumerable: true, get: function () { return resolveDir_1.resolveDir; } });
|
|
57
|
-
var resolveFrom_1 = require("./resolveFrom");
|
|
58
|
-
Object.defineProperty(exports, "resolveFrom", { enumerable: true, get: function () { return resolveFrom_1.resolveFrom; } });
|
|
59
|
-
var safeEqual_1 = require("./safeEqual");
|
|
60
|
-
Object.defineProperty(exports, "safeEqual", { enumerable: true, get: function () { return safeEqual_1.safeEqual; } });
|
|
61
|
-
exports.string = __importStar(require("./string"));
|
|
62
|
-
exports.types = __importStar(require("./types"));
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Require all files from a given directory. The method automatically looks
|
|
3
|
-
* for files ending with `.ts`, `.js` and `.json`. Also files ending with
|
|
4
|
-
* `.d.ts` are ignored.
|
|
5
|
-
*/
|
|
6
|
-
export declare function requireAll(location: string, recursive?: boolean, optional?: boolean, filter?: (file: string) => boolean | string): {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
} | undefined;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @poppinss/utils
|
|
4
|
-
*
|
|
5
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.requireAll = void 0;
|
|
15
|
-
const path_1 = require("path");
|
|
16
|
-
const require_all_1 = __importDefault(require("require-all"));
|
|
17
|
-
const esmResolver_1 = require("../esmResolver");
|
|
18
|
-
const isScriptFile_1 = require("../isScriptFile");
|
|
19
|
-
/**
|
|
20
|
-
* Function to filter and keep script files only
|
|
21
|
-
*/
|
|
22
|
-
function fileFilter(file) {
|
|
23
|
-
return (0, isScriptFile_1.isScriptFile)(file);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Require all files from a given directory. The method automatically looks
|
|
27
|
-
* for files ending with `.ts`, `.js` and `.json`. Also files ending with
|
|
28
|
-
* `.d.ts` are ignored.
|
|
29
|
-
*/
|
|
30
|
-
function requireAll(location, recursive = true, optional = false, filter = fileFilter) {
|
|
31
|
-
try {
|
|
32
|
-
return (0, require_all_1.default)({
|
|
33
|
-
dirname: location,
|
|
34
|
-
recursive,
|
|
35
|
-
filter: (file) => {
|
|
36
|
-
let result = true;
|
|
37
|
-
/**
|
|
38
|
-
* Invoke user defined function
|
|
39
|
-
*/
|
|
40
|
-
if (typeof filter === 'function') {
|
|
41
|
-
result = filter(file);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Use the default file name when file is meant to
|
|
45
|
-
* be kept
|
|
46
|
-
*/
|
|
47
|
-
if (result === true) {
|
|
48
|
-
const ext = (0, path_1.extname)(file);
|
|
49
|
-
return file.replace(new RegExp(`${ext}$`), '');
|
|
50
|
-
}
|
|
51
|
-
return result;
|
|
52
|
-
},
|
|
53
|
-
resolve: esmResolver_1.esmResolver,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
if (error.code === 'ENOENT' && optional) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
throw error;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.requireAll = requireAll;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @poppinss/utils
|
|
4
|
-
*
|
|
5
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.resolveDir = void 0;
|
|
15
|
-
const resolve_from_1 = __importDefault(require("resolve-from"));
|
|
16
|
-
const path_1 = require("path");
|
|
17
|
-
/**
|
|
18
|
-
* Resolves path to a given directory. The method is similar to `require.resolve`,
|
|
19
|
-
* but also works for directories with no `index.js` file.
|
|
20
|
-
*/
|
|
21
|
-
function resolveDir(fromLocation, dirPath) {
|
|
22
|
-
if ((0, path_1.isAbsolute)(dirPath)) {
|
|
23
|
-
return dirPath;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Relative paths are made by joining the baseDir
|
|
27
|
-
*/
|
|
28
|
-
if (dirPath.startsWith('./') || dirPath.startsWith(`.${path_1.sep}`)) {
|
|
29
|
-
return (0, path_1.join)(fromLocation, dirPath);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* From here on, we are dealing with a package inside node module.
|
|
33
|
-
*/
|
|
34
|
-
let packageName = '';
|
|
35
|
-
const tokens = dirPath.replace(/\\/g, '/').split('/');
|
|
36
|
-
if (tokens.length && tokens[0].startsWith('@')) {
|
|
37
|
-
packageName = `${tokens.shift()}/`;
|
|
38
|
-
}
|
|
39
|
-
packageName += tokens.shift();
|
|
40
|
-
const resolved = resolve_from_1.default.silent(fromLocation, (0, path_1.join)(packageName, 'package.json'));
|
|
41
|
-
if (!resolved) {
|
|
42
|
-
throw new Error(`Cannot locate directory "${dirPath}"`);
|
|
43
|
-
}
|
|
44
|
-
return (0, path_1.join)((0, path_1.dirname)(resolved), tokens.join('/'));
|
|
45
|
-
}
|
|
46
|
-
exports.resolveDir = resolveDir;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @poppinss/utils
|
|
4
|
-
*
|
|
5
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.resolveFrom = void 0;
|
|
15
|
-
const path_1 = require("path");
|
|
16
|
-
const resolve_from_1 = __importDefault(require("resolve-from"));
|
|
17
|
-
/**
|
|
18
|
-
* Resolves module from a given directory. It is similar to `require.resolve`
|
|
19
|
-
* but carefull handles the absolute paths.
|
|
20
|
-
*/
|
|
21
|
-
function resolveFrom(fromLocation, modulePath) {
|
|
22
|
-
if ((0, path_1.isAbsolute)(modulePath)) {
|
|
23
|
-
return modulePath;
|
|
24
|
-
}
|
|
25
|
-
return (0, resolve_from_1.default)(fromLocation, modulePath);
|
|
26
|
-
}
|
|
27
|
-
exports.resolveFrom = resolveFrom;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @poppinss/utils
|
|
4
|
-
*
|
|
5
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.safeEqual = void 0;
|
|
12
|
-
const buffer_1 = require("buffer");
|
|
13
|
-
const crypto_1 = require("crypto");
|
|
14
|
-
/**
|
|
15
|
-
* Generates a random string for a given size
|
|
16
|
-
*/
|
|
17
|
-
function safeEqual(value, comparisonValue) {
|
|
18
|
-
if (typeof value === 'string' && typeof comparisonValue === 'string') {
|
|
19
|
-
/**
|
|
20
|
-
* The length of the main value to ensure that we compare equal strings
|
|
21
|
-
* against each other to get a constant time.
|
|
22
|
-
*/
|
|
23
|
-
const expectedLength = buffer_1.Buffer.byteLength(value);
|
|
24
|
-
/**
|
|
25
|
-
* Value A
|
|
26
|
-
*/
|
|
27
|
-
const valueBuffer = buffer_1.Buffer.alloc(expectedLength, 0, 'utf-8');
|
|
28
|
-
valueBuffer.write(value);
|
|
29
|
-
/**
|
|
30
|
-
* Value B
|
|
31
|
-
*/
|
|
32
|
-
const comparisonValueBuffer = buffer_1.Buffer.alloc(expectedLength, 0, 'utf-8');
|
|
33
|
-
comparisonValueBuffer.write(comparisonValue);
|
|
34
|
-
/**
|
|
35
|
-
* Ensure values are same and also have same length
|
|
36
|
-
*/
|
|
37
|
-
return ((0, crypto_1.timingSafeEqual)(valueBuffer, comparisonValueBuffer) &&
|
|
38
|
-
expectedLength === buffer_1.Buffer.byteLength(comparisonValue));
|
|
39
|
-
}
|
|
40
|
-
return (0, crypto_1.timingSafeEqual)(buffer_1.Buffer.from(value), buffer_1.Buffer.from(comparisonValue));
|
|
41
|
-
}
|
|
42
|
-
exports.safeEqual = safeEqual;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { EncodeOptions } from 'he';
|
|
2
|
-
import { BytesOptions } from 'bytes';
|
|
3
|
-
export { default as toSlug } from 'slugify';
|
|
4
|
-
/**
|
|
5
|
-
* The method is a copy/paste from the "title-case" package. They have
|
|
6
|
-
* a dependency on "tslib", which I don't want.
|
|
7
|
-
*/
|
|
8
|
-
export declare function titleCase(input: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Define an irregular rule
|
|
11
|
-
*/
|
|
12
|
-
export declare function defineIrregularRule(singleValue: string, pluralValue: string): void;
|
|
13
|
-
/**
|
|
14
|
-
* Define uncountable rule
|
|
15
|
-
*/
|
|
16
|
-
export declare function defineUncountableRule(word: string): void;
|
|
17
|
-
/**
|
|
18
|
-
* Convert string to camelcase
|
|
19
|
-
*/
|
|
20
|
-
export declare function camelCase(value: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Convert string to snakecase
|
|
23
|
-
*/
|
|
24
|
-
export declare function snakeCase(value: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* Convert string to dashcase
|
|
27
|
-
*/
|
|
28
|
-
export declare function dashCase(value: string, options?: {
|
|
29
|
-
capitalize?: boolean;
|
|
30
|
-
}): string;
|
|
31
|
-
/**
|
|
32
|
-
* Convert string to pascal case
|
|
33
|
-
*/
|
|
34
|
-
export declare function pascalCase(value: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Convert string to capital case
|
|
37
|
-
*/
|
|
38
|
-
export declare function capitalCase(value: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Convert string to sentence case
|
|
41
|
-
*/
|
|
42
|
-
export declare function sentenceCase(value: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Convert string to dot case
|
|
45
|
-
*/
|
|
46
|
-
export declare function dotCase(value: string): string;
|
|
47
|
-
/**
|
|
48
|
-
* Remove all sort of casing from the string
|
|
49
|
-
*/
|
|
50
|
-
export declare function noCase(value: string): string;
|
|
51
|
-
/**
|
|
52
|
-
* Pluralize a word
|
|
53
|
-
*/
|
|
54
|
-
export declare function pluralize(word: string): string;
|
|
55
|
-
/**
|
|
56
|
-
* Singularize a word
|
|
57
|
-
*/
|
|
58
|
-
export declare function singularize(word: string): string;
|
|
59
|
-
/**
|
|
60
|
-
* Truncate a sentence till a give limit of characters
|
|
61
|
-
*/
|
|
62
|
-
export declare function truncate(sentence: string, charactersLimit: number, options?: {
|
|
63
|
-
completeWords?: boolean;
|
|
64
|
-
suffix?: string;
|
|
65
|
-
}): string;
|
|
66
|
-
/**
|
|
67
|
-
* Same as truncate, but strips out the HTML
|
|
68
|
-
*/
|
|
69
|
-
export declare function excerpt(sentence: string, charactersLimit: number, options?: {
|
|
70
|
-
completeWords?: boolean;
|
|
71
|
-
suffix?: string;
|
|
72
|
-
}): string;
|
|
73
|
-
/**
|
|
74
|
-
* Condenses multiple whitespaces from a string
|
|
75
|
-
*/
|
|
76
|
-
export declare function condenseWhitespace(value: string): string;
|
|
77
|
-
/**
|
|
78
|
-
* Escape HTML entities
|
|
79
|
-
*/
|
|
80
|
-
export declare function escapeHTML(value: string, options?: {
|
|
81
|
-
encodeSymbols?: boolean;
|
|
82
|
-
}): string;
|
|
83
|
-
/**
|
|
84
|
-
* Encode symbols that aren’t printable ASCII symbols
|
|
85
|
-
*/
|
|
86
|
-
export declare function encodeSymbols(value: string, options?: EncodeOptions): string;
|
|
87
|
-
/**
|
|
88
|
-
* Convert array of values to a sentence
|
|
89
|
-
*/
|
|
90
|
-
export declare function toSentence(values: any[], options?: {
|
|
91
|
-
separator?: string;
|
|
92
|
-
pairSeparator?: string;
|
|
93
|
-
lastSeparator?: string;
|
|
94
|
-
}): string;
|
|
95
|
-
/**
|
|
96
|
-
* Convert a number to a human readable string
|
|
97
|
-
*/
|
|
98
|
-
export declare function prettyBytes(value: number, options?: BytesOptions): string;
|
|
99
|
-
/**
|
|
100
|
-
* Convert milliseconds to a human readable string
|
|
101
|
-
*/
|
|
102
|
-
export declare function prettyMs(value: number, options?: {
|
|
103
|
-
long: boolean;
|
|
104
|
-
}): string;
|
|
105
|
-
/**
|
|
106
|
-
* Find if a string is empty. Including any number of whitespaces
|
|
107
|
-
*/
|
|
108
|
-
export declare function isEmpty(value: string): boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Ordinalize a give number or string
|
|
111
|
-
*/
|
|
112
|
-
export declare function ordinalize(value: string | number): string;
|
|
113
|
-
/**
|
|
114
|
-
* Converts unit expression to bytes
|
|
115
|
-
*/
|
|
116
|
-
export declare function toBytes(value: string | number): number;
|
|
117
|
-
/**
|
|
118
|
-
* Converts time expression to milliseconds
|
|
119
|
-
*/
|
|
120
|
-
export declare function toMs(value: string | number): number;
|
|
121
|
-
/**
|
|
122
|
-
* Generates a random string for a given size
|
|
123
|
-
*/
|
|
124
|
-
export declare function generateRandom(size: number): string;
|