utilitish 0.0.23 → 0.0.25
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/dist/array/array-constructor.js +2 -2
- package/dist/array/array-prototype.d.ts +1 -1
- package/dist/array/array-prototype.js +2 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/dist/map/map-prototype.js +1 -1
- package/dist/object/object-prototype.js +1 -1
- package/dist/set/set-prototype.js +1 -1
- package/dist/set/set-prototype.spec.d.ts +1 -1
- package/dist/set/set-prototype.spec.js +8 -1
- package/dist/string/string-prototype.d.ts +1 -1
- package/dist/string/string-prototype.js +2 -2
- package/dist/string/string-prototype.spec.d.ts +1 -1
- package/dist/string/string-prototype.spec.js +2 -2
- package/dist/utils/core.utils.spec.js +1 -1
- package/dist/utils/logic.utils.d.ts +1 -1
- package/dist/utils/logic.utils.js +1 -1
- package/dist/utils/logic.utils.spec.js +1 -1
- package/dist/utils/slugify.config.js +14 -7
- package/dist/utils/slugify.config.spec.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineStaticIfNotExists } from '../utils/core.utils';
|
|
2
|
-
import { utilitishError } from './../utils/core.utils';
|
|
1
|
+
import { defineStaticIfNotExists } from '../utils/core.utils.js';
|
|
2
|
+
import { utilitishError } from './../utils/core.utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* @see Array.zip
|
|
5
5
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineIfNotExists, isNumberOrString, resolveSelector, utilitishError } from '../utils/core.utils';
|
|
2
|
-
import { sortBy } from '../utils/logic.utils';
|
|
1
|
+
import { defineIfNotExists, isNumberOrString, resolveSelector, utilitishError } from '../utils/core.utils.js';
|
|
2
|
+
import { sortBy } from '../utils/logic.utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* @see Array.prototype.first
|
|
5
5
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import './array/array-constructor';
|
|
2
|
-
import './array/array-prototype';
|
|
3
|
-
import './map/map-prototype';
|
|
4
|
-
import './object/object-prototype';
|
|
5
|
-
import './set/set-prototype';
|
|
6
|
-
import './string/string-prototype';
|
|
7
|
-
export { getSlugifyConfig, resetSlugifyConfig, setSlugifyConfig,
|
|
1
|
+
import './array/array-constructor.js';
|
|
2
|
+
import './array/array-prototype.js';
|
|
3
|
+
import './map/map-prototype.js';
|
|
4
|
+
import './object/object-prototype.js';
|
|
5
|
+
import './set/set-prototype.js';
|
|
6
|
+
import './string/string-prototype.js';
|
|
7
|
+
export { getSlugifyConfig, resetSlugifyConfig, setSlugifyConfig, SlugifyConfig } from './utils/slugify.config.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import './array/array-constructor';
|
|
2
|
-
import './array/array-prototype';
|
|
3
|
-
import './map/map-prototype';
|
|
4
|
-
import './object/object-prototype';
|
|
5
|
-
import './set/set-prototype';
|
|
6
|
-
import './string/string-prototype';
|
|
1
|
+
import './array/array-constructor.js';
|
|
2
|
+
import './array/array-prototype.js';
|
|
3
|
+
import './map/map-prototype.js';
|
|
4
|
+
import './object/object-prototype.js';
|
|
5
|
+
import './set/set-prototype.js';
|
|
6
|
+
import './string/string-prototype.js';
|
|
7
7
|
// Export slugify configuration functions
|
|
8
|
-
export { getSlugifyConfig, resetSlugifyConfig, setSlugifyConfig } from './utils/slugify.config';
|
|
8
|
+
export { getSlugifyConfig, resetSlugifyConfig, setSlugifyConfig, SlugifyConfig } from './utils/slugify.config.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '../set/set-prototype';
|
|
1
|
+
import '../set/set-prototype.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '../set/set-prototype';
|
|
1
|
+
import '../set/set-prototype.js';
|
|
2
2
|
describe('Set.prototype', () => {
|
|
3
3
|
describe('toList()', () => {
|
|
4
4
|
it('should return array with all values in insertion order', () => {
|
|
@@ -69,10 +69,17 @@ describe('Set.prototype', () => {
|
|
|
69
69
|
const b = new Set([2, 3]);
|
|
70
70
|
expect(a.union(b)).toEqual(new Set([1, 2, 3]));
|
|
71
71
|
});
|
|
72
|
+
it('should work with multiple inputs', () => {
|
|
73
|
+
const a = new Set([1, 2]);
|
|
74
|
+
const b = new Set([2, 3]);
|
|
75
|
+
const c = new Set([2, 4]);
|
|
76
|
+
expect(a.union(b, c)).toEqual(new Set([1, 2, 3, 4]));
|
|
77
|
+
});
|
|
72
78
|
});
|
|
73
79
|
describe('with no arguments', () => {
|
|
74
80
|
it('should return a copy of the Set when no arguments provided', () => {
|
|
75
81
|
const a = new Set([1, 2]);
|
|
82
|
+
// @ts-nocheck
|
|
76
83
|
expect(a.union()).toEqual(new Set([1, 2]));
|
|
77
84
|
});
|
|
78
85
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineIfNotExists, utilitishError } from '../utils/core.utils';
|
|
2
|
-
import { slugifyString } from '../utils/slugify.config';
|
|
1
|
+
import { defineIfNotExists, utilitishError } from '../utils/core.utils.js';
|
|
2
|
+
import { slugifyString } from '../utils/slugify.config.js';
|
|
3
3
|
/**
|
|
4
4
|
* @see String.prototype.splitWords
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '../string/string-prototype';
|
|
1
|
+
import '../string/string-prototype.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '../string/string-prototype';
|
|
2
|
-
import { resetSlugifyConfig, setSlugifyConfig, SlugifyConfig } from '../utils/slugify.config';
|
|
1
|
+
import '../string/string-prototype.js';
|
|
2
|
+
import { resetSlugifyConfig, setSlugifyConfig, SlugifyConfig } from '../utils/slugify.config.js';
|
|
3
3
|
describe('String.prototype', () => {
|
|
4
4
|
describe('capitalize()', () => {
|
|
5
5
|
it('should capitalize the first character', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assertValidSelector, defineIfNotExists, defineStaticIfNotExists, isNumberOrString, resolveSelector, utilitishError, } from './core.utils';
|
|
1
|
+
import { assertValidSelector, defineIfNotExists, defineStaticIfNotExists, isNumberOrString, resolveSelector, utilitishError, } from './core.utils.js';
|
|
2
2
|
describe('core.utils', () => {
|
|
3
3
|
describe('defineIfNotExists()', () => {
|
|
4
4
|
it('should define a new method on a prototype', () => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Selector } from './core.utils';
|
|
1
|
+
import { Selector } from './core.utils.js';
|
|
2
2
|
export declare function sortBy<T>(arr: T[], direction: 'asc' | 'desc', selector?: Selector<T, number | string>): T[];
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* Provides comprehensive customization options for URL slug generation.
|
|
4
4
|
*/
|
|
5
5
|
export class SlugifyConfig {
|
|
6
|
+
_customReplacements;
|
|
7
|
+
_separator;
|
|
8
|
+
_case;
|
|
9
|
+
_removeAccents;
|
|
10
|
+
_allowedChars;
|
|
11
|
+
_maxLength;
|
|
12
|
+
_transformers;
|
|
6
13
|
constructor(builder) {
|
|
7
14
|
this._customReplacements = builder.customReplacements;
|
|
8
15
|
this._separator = builder.separator;
|
|
@@ -133,13 +140,13 @@ export class SlugifyConfig {
|
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
export class SlugifyConfigBuilder {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
customReplacements = {};
|
|
144
|
+
separator = '-';
|
|
145
|
+
case = 'lower';
|
|
146
|
+
removeAccents = true;
|
|
147
|
+
allowedChars;
|
|
148
|
+
maxLength;
|
|
149
|
+
transformers = [];
|
|
143
150
|
withCustomReplacements(replacements) {
|
|
144
151
|
this.customReplacements = { ...replacements };
|
|
145
152
|
return this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SlugifyConfig, assertCharClass, assertSlugifyConfig, getDefaultSlugifyConfig, getSlugifyConfig, resetSlugifyConfig, setSlugifyConfig, } from './slugify.config';
|
|
1
|
+
import { SlugifyConfig, assertCharClass, assertSlugifyConfig, getDefaultSlugifyConfig, getSlugifyConfig, resetSlugifyConfig, setSlugifyConfig, } from './slugify.config.js';
|
|
2
2
|
describe('slugify.config', () => {
|
|
3
3
|
afterEach(() => {
|
|
4
4
|
resetSlugifyConfig();
|