si-funciona 2.3.3 → 2.3.4
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 +1337 -1244
- package/browser/siFunciona.js +24205 -24146
- package/dist/helpers/arrays/BasicQueue.d.ts +65 -61
- package/dist/helpers/arrays/BasicQueue.js +62 -59
- package/dist/helpers/arrays.d.ts +21 -20
- package/dist/helpers/arrays.js +33 -32
- package/dist/helpers/descriptors/assignDescriptor.d.ts +14 -11
- package/dist/helpers/descriptors/assignDescriptor.js +58 -55
- package/dist/helpers/descriptors/assignDescriptorDetail.d.ts +14 -11
- package/dist/helpers/descriptors/assignDescriptorDetail.js +37 -34
- package/dist/helpers/descriptors/checkClearValues.d.ts +12 -11
- package/dist/helpers/descriptors/checkClearValues.js +21 -20
- package/dist/helpers/descriptors/checkDescriptorComplete.d.ts +11 -10
- package/dist/helpers/descriptors/checkDescriptorComplete.js +20 -19
- package/dist/helpers/descriptors/cloneDescriptor.d.ts +10 -10
- package/dist/helpers/descriptors/cloneDescriptor.js +36 -36
- package/dist/helpers/descriptors/cloneDescriptorDetail.d.ts +10 -10
- package/dist/helpers/descriptors/cloneDescriptorDetail.js +27 -27
- package/dist/helpers/descriptors/compareDescriptor.d.ts +13 -11
- package/dist/helpers/descriptors/compareDescriptor.js +33 -31
- package/dist/helpers/descriptors/describeObject.d.ts +15 -13
- package/dist/helpers/descriptors/describeObject.js +53 -51
- package/dist/helpers/descriptors/describeObjectDetail.d.ts +14 -12
- package/dist/helpers/descriptors/describeObjectDetail.js +38 -36
- package/dist/helpers/descriptors/describeObjectMap.d.ts +36 -20
- package/dist/helpers/descriptors/describeObjectMap.js +108 -92
- package/dist/helpers/descriptors/nextReference.d.ts +13 -11
- package/dist/helpers/descriptors/nextReference.js +31 -29
- package/dist/helpers/descriptors/sameDescriptor.d.ts +13 -11
- package/dist/helpers/descriptors/sameDescriptor.js +22 -20
- package/dist/helpers/descriptors/samples/descriptor.d.ts +34 -27
- package/dist/helpers/descriptors/samples/descriptorDetail.d.ts +42 -34
- package/dist/helpers/descriptors/samples/descriptorMap.d.ts +16 -12
- package/dist/helpers/descriptors/samples/mappedDescriptorMap.d.ts +10 -7
- package/dist/helpers/descriptors/samples/mappedDescriptorMap.js +287 -284
- package/dist/helpers/descriptors.d.ts +44 -28
- package/dist/helpers/descriptors.js +58 -42
- package/dist/helpers/functions/makeBasicQueue.d.ts +10 -10
- package/dist/helpers/functions/makeBasicQueue.js +19 -19
- package/dist/helpers/functions/queueManager.d.ts +49 -47
- package/dist/helpers/functions/queueManager.js +124 -122
- package/dist/helpers/functions/relevancyFilter.d.ts +35 -35
- package/dist/helpers/functions/relevancyFilter.js +34 -34
- package/dist/helpers/functions/trace.d.ts +14 -12
- package/dist/helpers/functions/trace.js +25 -23
- package/dist/helpers/numbers/lowestCommonDenominator.d.ts +10 -10
- package/dist/helpers/numbers/lowestCommonDenominator.js +20 -20
- package/dist/helpers/strings/camelCase.d.ts +9 -9
- package/dist/helpers/strings/camelCase.js +20 -20
- package/dist/helpers/strings/kabobCase.d.ts +9 -9
- package/dist/helpers/strings/kabobCase.js +19 -19
- package/dist/helpers/strings/makeFilepath.d.ts +9 -9
- package/dist/helpers/strings/makeFilepath.js +49 -49
- package/dist/helpers/strings/makeRelativePath.d.ts +9 -9
- package/dist/helpers/strings/makeRelativePath.js +43 -43
- package/dist/helpers/strings/regexEscape.d.ts +8 -8
- package/dist/helpers/strings/regexEscape.js +15 -15
- package/dist/helpers/strings/snakeCase.d.ts +9 -9
- package/dist/helpers/strings/snakeCase.js +19 -19
- package/dist/helpers/strings/strAfter.d.ts +10 -10
- package/dist/helpers/strings/strAfter.js +19 -19
- package/dist/helpers/strings/strAfterLast.d.ts +10 -10
- package/dist/helpers/strings/strAfterLast.js +19 -19
- package/dist/helpers/strings/strBefore.d.ts +10 -10
- package/dist/helpers/strings/strBefore.js +19 -19
- package/dist/helpers/strings/strBeforeLast.d.ts +10 -10
- package/dist/helpers/strings/strBeforeLast.js +19 -19
- package/dist/helpers/strings/titleCase.d.ts +9 -9
- package/dist/helpers/strings/titleCase.js +20 -20
- package/dist/helpers/strings/ucFirst.d.ts +9 -9
- package/dist/helpers/strings/ucFirst.js +15 -15
- package/dist/helpers/strings/words.d.ts +10 -9
- package/dist/helpers/strings/words.js +16 -15
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0
|
|
7
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
-
require('core-js/modules/esnext.iterator.filter.js')
|
|
9
|
-
require('core-js/modules/esnext.iterator.map.js')
|
|
10
|
-
require('core-js/stable')
|
|
11
|
-
/**
|
|
12
|
-
* Remove elements out of relevance range and update the max relevance.
|
|
13
|
-
* @memberOf module:functionHelpers
|
|
14
|
-
* @param {relevanceMap} map
|
|
15
|
-
* @param {Object} [options={}]
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @returns {relevanceMap}
|
|
19
|
-
*/
|
|
20
|
-
const relevancyFilter = (map, {
|
|
21
|
-
mapLimit = 1000,
|
|
22
|
-
relevancyRange = 100
|
|
23
|
-
} = {}) => {
|
|
24
|
-
if (map.length <= mapLimit) {
|
|
25
|
-
return map
|
|
26
|
-
}
|
|
27
|
-
const minRelevance = map.length - relevancyRange
|
|
28
|
-
const filtered = map.filter(reference => reference.relevance >= minRelevance)
|
|
29
|
-
return filtered.map(reference => {
|
|
30
|
-
reference.relevance = reference.relevance > filtered.length ? filtered.length : reference.relevance
|
|
31
|
-
return reference
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
var _default = exports.default = relevancyFilter
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.default = void 0
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
+
require('core-js/modules/esnext.iterator.filter.js')
|
|
9
|
+
require('core-js/modules/esnext.iterator.map.js')
|
|
10
|
+
require('core-js/stable')
|
|
11
|
+
/**
|
|
12
|
+
* Remove elements out of relevance range and update the max relevance.
|
|
13
|
+
* @memberOf module:functionHelpers
|
|
14
|
+
* @param {relevanceMap} map
|
|
15
|
+
* @param {Object} [options={}]
|
|
16
|
+
* @param {number} [options.mapLimit=1000] - Only filter once the map exceeds this many entries.
|
|
17
|
+
* @param {number} [options.relevancyRange=100] - How many of the most-recent relevance values to keep.
|
|
18
|
+
* @returns {relevanceMap}
|
|
19
|
+
*/
|
|
20
|
+
const relevancyFilter = (map, {
|
|
21
|
+
mapLimit = 1000,
|
|
22
|
+
relevancyRange = 100
|
|
23
|
+
} = {}) => {
|
|
24
|
+
if (map.length <= mapLimit) {
|
|
25
|
+
return map
|
|
26
|
+
}
|
|
27
|
+
const minRelevance = map.length - relevancyRange
|
|
28
|
+
const filtered = map.filter(reference => reference.relevance >= minRelevance)
|
|
29
|
+
return filtered.map(reference => {
|
|
30
|
+
reference.relevance = reference.relevance > filtered.length ? filtered.length : reference.relevance
|
|
31
|
+
return reference
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
var _default = exports.default = relevancyFilter
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
import 'regenerator-runtime/runtime';
|
|
3
|
-
type outputAndReturn = (value: any) => any;
|
|
4
|
-
/**
|
|
5
|
-
* Output the value with label to the console and return the value to not interrupt the code
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import 'regenerator-runtime/runtime';
|
|
3
|
+
type outputAndReturn = (value: any) => any;
|
|
4
|
+
/**
|
|
5
|
+
* Output the value with label to the console and return the value to not interrupt the code - useful for
|
|
6
|
+
* inspecting a value mid-pipe/mid-chain without altering the result.
|
|
7
|
+
* @memberOf module:functionHelpers
|
|
8
|
+
* @param {string} label - Pass an identifying label of the value being output.
|
|
9
|
+
* @param {boolean} [useClone=true] - Determines if the logged data should be a clone of the original to preserve
|
|
10
|
+
* its state at the time of logging (rather than a live reference that may show later mutations).
|
|
11
|
+
* @returns {function(*=)}
|
|
12
|
+
*/
|
|
13
|
+
declare const trace: (label: string, useClone?: boolean) => outputAndReturn;
|
|
14
|
+
export default trace;
|
|
13
15
|
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0
|
|
7
|
-
require('core-js/stable')
|
|
8
|
-
require('regenerator-runtime/runtime')
|
|
9
|
-
var _cloneObject = _interopRequireDefault(require('../objects/cloneObject'))
|
|
10
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
11
|
-
/**
|
|
12
|
-
* Output the value with label to the console and return the value to not interrupt the code
|
|
13
|
-
*
|
|
14
|
-
* @
|
|
15
|
-
* @param
|
|
16
|
-
* @
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.default = void 0
|
|
7
|
+
require('core-js/stable')
|
|
8
|
+
require('regenerator-runtime/runtime')
|
|
9
|
+
var _cloneObject = _interopRequireDefault(require('../objects/cloneObject'))
|
|
10
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
11
|
+
/**
|
|
12
|
+
* Output the value with label to the console and return the value to not interrupt the code - useful for
|
|
13
|
+
* inspecting a value mid-pipe/mid-chain without altering the result.
|
|
14
|
+
* @memberOf module:functionHelpers
|
|
15
|
+
* @param {string} label - Pass an identifying label of the value being output.
|
|
16
|
+
* @param {boolean} [useClone=true] - Determines if the logged data should be a clone of the original to preserve
|
|
17
|
+
* its state at the time of logging (rather than a live reference that may show later mutations).
|
|
18
|
+
* @returns {function(*=)}
|
|
19
|
+
*/
|
|
20
|
+
const trace = (label, useClone = true) => value => {
|
|
21
|
+
// noinspection JSForgottenDebugStatementInspection
|
|
22
|
+
console.info(`${label}: `, useClone ? (0, _cloneObject.default)(value) : value)
|
|
23
|
+
return value
|
|
24
|
+
}
|
|
25
|
+
var _default = exports.default = trace
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @param {number}
|
|
7
|
-
* @returns {number}
|
|
8
|
-
*/
|
|
9
|
-
declare const lowestCommonDenominator: (...numbers: number[]) => number;
|
|
10
|
-
export default lowestCommonDenominator;
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Find the smallest number that all the given numbers divide into evenly, by reducing them pairwise with
|
|
4
|
+
* leastCommonMultiple.
|
|
5
|
+
* @memberOf module:numberHelpers
|
|
6
|
+
* @param {...number} numbers - Two or more numbers to find the lowest common denominator of.
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
declare const lowestCommonDenominator: (...numbers: number[]) => number;
|
|
10
|
+
export default lowestCommonDenominator;
|
|
11
11
|
//# sourceMappingURL=lowestCommonDenominator.d.ts.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0
|
|
7
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
-
require('core-js/modules/esnext.iterator.reduce.js')
|
|
9
|
-
require('core-js/stable')
|
|
10
|
-
var _leastCommonMultiple = _interopRequireDefault(require('./leastCommonMultiple'))
|
|
11
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @
|
|
16
|
-
* @param {number}
|
|
17
|
-
* @returns {number}
|
|
18
|
-
*/
|
|
19
|
-
const lowestCommonDenominator = (...numbers) => numbers.reduce((num1, num2) => (0, _leastCommonMultiple.default)(num1, num2), 1)
|
|
20
|
-
var _default = exports.default = lowestCommonDenominator
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.default = void 0
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
+
require('core-js/modules/esnext.iterator.reduce.js')
|
|
9
|
+
require('core-js/stable')
|
|
10
|
+
var _leastCommonMultiple = _interopRequireDefault(require('./leastCommonMultiple'))
|
|
11
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
+
/**
|
|
13
|
+
* Find the smallest number that all the given numbers divide into evenly, by reducing them pairwise with
|
|
14
|
+
* leastCommonMultiple.
|
|
15
|
+
* @memberOf module:numberHelpers
|
|
16
|
+
* @param {...number} numbers - Two or more numbers to find the lowest common denominator of.
|
|
17
|
+
* @returns {number}
|
|
18
|
+
*/
|
|
19
|
+
const lowestCommonDenominator = (...numbers) => numbers.reduce((num1, num2) => (0, _leastCommonMultiple.default)(num1, num2), 1)
|
|
20
|
+
var _default = exports.default = lowestCommonDenominator
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
/**
|
|
3
|
-
* Given a string in kebab-case, snake_case or 'Sentence case', convert to camelCase.
|
|
4
|
-
* @memberOf module:stringHelpers
|
|
5
|
-
* @param {string} str
|
|
6
|
-
* @returns {string}
|
|
7
|
-
*/
|
|
8
|
-
declare const camelCase: (str: string) => string;
|
|
9
|
-
export default camelCase;
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Given a string in kebab-case, snake_case or 'Sentence case', convert to camelCase.
|
|
4
|
+
* @memberOf module:stringHelpers
|
|
5
|
+
* @param {string} str - The string to convert.
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
declare const camelCase: (str: string) => string;
|
|
9
|
+
export default camelCase;
|
|
10
10
|
//# sourceMappingURL=camelCase.d.ts.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0
|
|
7
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
-
require('core-js/modules/esnext.iterator.reduce.js')
|
|
9
|
-
require('core-js/stable')
|
|
10
|
-
var _ucFirst = _interopRequireDefault(require('./ucFirst'))
|
|
11
|
-
var _words = _interopRequireDefault(require('./words'))
|
|
12
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
13
|
-
/**
|
|
14
|
-
* Given a string in kebab-case, snake_case or 'Sentence case', convert to camelCase.
|
|
15
|
-
* @memberOf module:stringHelpers
|
|
16
|
-
* @param {string} str
|
|
17
|
-
* @returns {string}
|
|
18
|
-
*/
|
|
19
|
-
const camelCase = str => (0, _words.default)(str).reduce((camel, part) => camel ? camel.concat((0, _ucFirst.default)(part)) : part.toLowerCase(), '')
|
|
20
|
-
var _default = exports.default = camelCase
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.default = void 0
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
+
require('core-js/modules/esnext.iterator.reduce.js')
|
|
9
|
+
require('core-js/stable')
|
|
10
|
+
var _ucFirst = _interopRequireDefault(require('./ucFirst'))
|
|
11
|
+
var _words = _interopRequireDefault(require('./words'))
|
|
12
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
13
|
+
/**
|
|
14
|
+
* Given a string in kebab-case, snake_case or 'Sentence case', convert to camelCase.
|
|
15
|
+
* @memberOf module:stringHelpers
|
|
16
|
+
* @param {string} str - The string to convert.
|
|
17
|
+
* @returns {string}
|
|
18
|
+
*/
|
|
19
|
+
const camelCase = str => (0, _words.default)(str).reduce((camel, part) => camel ? camel.concat((0, _ucFirst.default)(part)) : part.toLowerCase(), '')
|
|
20
|
+
var _default = exports.default = camelCase
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
/**
|
|
3
|
-
* Given a string in snake_case, camelCase or 'Sentence case', convert to kabob-case.
|
|
4
|
-
* @memberOf module:stringHelpers
|
|
5
|
-
* @param {string} str
|
|
6
|
-
* @returns {string}
|
|
7
|
-
*/
|
|
8
|
-
declare const kabobCase: (str: string) => string;
|
|
9
|
-
export default kabobCase;
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Given a string in snake_case, camelCase or 'Sentence case', convert to kabob-case.
|
|
4
|
+
* @memberOf module:stringHelpers
|
|
5
|
+
* @param {string} str - The string to convert.
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
declare const kabobCase: (str: string) => string;
|
|
9
|
+
export default kabobCase;
|
|
10
10
|
//# sourceMappingURL=kabobCase.d.ts.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0
|
|
7
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
-
require('core-js/modules/esnext.iterator.reduce.js')
|
|
9
|
-
require('core-js/stable')
|
|
10
|
-
var _words = _interopRequireDefault(require('./words'))
|
|
11
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
-
/**
|
|
13
|
-
* Given a string in snake_case, camelCase or 'Sentence case', convert to kabob-case.
|
|
14
|
-
* @memberOf module:stringHelpers
|
|
15
|
-
* @param {string} str
|
|
16
|
-
* @returns {string}
|
|
17
|
-
*/
|
|
18
|
-
const kabobCase = str => (0, _words.default)(str).reduce((kabob, part) => kabob ? kabob.concat('-' + part.toLowerCase()) : part.toLowerCase(), '')
|
|
19
|
-
var _default = exports.default = kabobCase
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.default = void 0
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
+
require('core-js/modules/esnext.iterator.reduce.js')
|
|
9
|
+
require('core-js/stable')
|
|
10
|
+
var _words = _interopRequireDefault(require('./words'))
|
|
11
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
+
/**
|
|
13
|
+
* Given a string in snake_case, camelCase or 'Sentence case', convert to kabob-case.
|
|
14
|
+
* @memberOf module:stringHelpers
|
|
15
|
+
* @param {string} str - The string to convert.
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
const kabobCase = str => (0, _words.default)(str).reduce((kabob, part) => kabob ? kabob.concat('-' + part.toLowerCase()) : part.toLowerCase(), '')
|
|
19
|
+
var _default = exports.default = kabobCase
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format the given path so that it does not have trailing slashes and also correctly appends a path.
|
|
3
|
-
* @memberOf module:stringHelpers
|
|
4
|
-
* @param {string} root
|
|
5
|
-
* @param {string} [append='']
|
|
6
|
-
* @returns {string}
|
|
7
|
-
*/
|
|
8
|
-
export declare const makeFilepath: (root: string, append?: string) => string;
|
|
9
|
-
export default makeFilepath;
|
|
1
|
+
/**
|
|
2
|
+
* Format the given path so that it does not have trailing slashes and also correctly appends a path.
|
|
3
|
+
* @memberOf module:stringHelpers
|
|
4
|
+
* @param {string} root - The base path to start from.
|
|
5
|
+
* @param {string} [append=''] - A path to append to `root` - may itself use `./` or `../` segments.
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
export declare const makeFilepath: (root: string, append?: string) => string;
|
|
9
|
+
export default makeFilepath;
|
|
10
10
|
//# sourceMappingURL=makeFilepath.d.ts.map
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.makeFilepath = exports.default = void 0
|
|
7
|
-
var _strBeforeLast = _interopRequireDefault(require('./strBeforeLast'))
|
|
8
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
9
|
-
/**
|
|
10
|
-
* Format the given path so that it does not have trailing slashes and also correctly appends a path.
|
|
11
|
-
* @memberOf module:stringHelpers
|
|
12
|
-
* @param {string} root
|
|
13
|
-
* @param {string} [append='']
|
|
14
|
-
* @returns {string}
|
|
15
|
-
*/
|
|
16
|
-
const makeFilepath = (root, append = '') => {
|
|
17
|
-
if (root.startsWith('./')) {
|
|
18
|
-
root = root.slice(2)
|
|
19
|
-
}
|
|
20
|
-
if (root.startsWith('/')) {
|
|
21
|
-
root = root.slice(1)
|
|
22
|
-
}
|
|
23
|
-
if (root.endsWith('/')) {
|
|
24
|
-
root = root.slice(0, -1)
|
|
25
|
-
}
|
|
26
|
-
if (append.startsWith('/')) {
|
|
27
|
-
append = append.slice(1)
|
|
28
|
-
}
|
|
29
|
-
if (append.startsWith('./')) {
|
|
30
|
-
append = append.slice(2)
|
|
31
|
-
}
|
|
32
|
-
if (append.startsWith('../')) {
|
|
33
|
-
if (!root) {
|
|
34
|
-
return append.endsWith('/') ? append.slice(0, -1) : append
|
|
35
|
-
}
|
|
36
|
-
append = append.slice(3)
|
|
37
|
-
root = (0, _strBeforeLast.default)(root, '/')
|
|
38
|
-
return makeFilepath(root, append)
|
|
39
|
-
}
|
|
40
|
-
if (append.endsWith('/')) {
|
|
41
|
-
append = append.slice(0, -1)
|
|
42
|
-
}
|
|
43
|
-
if (!root) {
|
|
44
|
-
return append
|
|
45
|
-
}
|
|
46
|
-
return append ? `${root}/${append}` : root
|
|
47
|
-
}
|
|
48
|
-
exports.makeFilepath = makeFilepath
|
|
49
|
-
var _default = exports.default = makeFilepath
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.makeFilepath = exports.default = void 0
|
|
7
|
+
var _strBeforeLast = _interopRequireDefault(require('./strBeforeLast'))
|
|
8
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
9
|
+
/**
|
|
10
|
+
* Format the given path so that it does not have trailing slashes and also correctly appends a path.
|
|
11
|
+
* @memberOf module:stringHelpers
|
|
12
|
+
* @param {string} root - The base path to start from.
|
|
13
|
+
* @param {string} [append=''] - A path to append to `root` - may itself use `./` or `../` segments.
|
|
14
|
+
* @returns {string}
|
|
15
|
+
*/
|
|
16
|
+
const makeFilepath = (root, append = '') => {
|
|
17
|
+
if (root.startsWith('./')) {
|
|
18
|
+
root = root.slice(2)
|
|
19
|
+
}
|
|
20
|
+
if (root.startsWith('/')) {
|
|
21
|
+
root = root.slice(1)
|
|
22
|
+
}
|
|
23
|
+
if (root.endsWith('/')) {
|
|
24
|
+
root = root.slice(0, -1)
|
|
25
|
+
}
|
|
26
|
+
if (append.startsWith('/')) {
|
|
27
|
+
append = append.slice(1)
|
|
28
|
+
}
|
|
29
|
+
if (append.startsWith('./')) {
|
|
30
|
+
append = append.slice(2)
|
|
31
|
+
}
|
|
32
|
+
if (append.startsWith('../')) {
|
|
33
|
+
if (!root) {
|
|
34
|
+
return append.endsWith('/') ? append.slice(0, -1) : append
|
|
35
|
+
}
|
|
36
|
+
append = append.slice(3)
|
|
37
|
+
root = (0, _strBeforeLast.default)(root, '/')
|
|
38
|
+
return makeFilepath(root, append)
|
|
39
|
+
}
|
|
40
|
+
if (append.endsWith('/')) {
|
|
41
|
+
append = append.slice(0, -1)
|
|
42
|
+
}
|
|
43
|
+
if (!root) {
|
|
44
|
+
return append
|
|
45
|
+
}
|
|
46
|
+
return append ? `${root}/${append}` : root
|
|
47
|
+
}
|
|
48
|
+
exports.makeFilepath = makeFilepath
|
|
49
|
+
var _default = exports.default = makeFilepath
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compare two file paths and simplify them to a relative path.
|
|
3
|
-
* @memberOf module:stringHelpers
|
|
4
|
-
* @param {string} fromFile
|
|
5
|
-
* @param {string} toFile
|
|
6
|
-
* @return {string}
|
|
7
|
-
*/
|
|
8
|
-
export declare const makeRelativePath: (fromFile: string, toFile: string) => string;
|
|
9
|
-
export default makeRelativePath;
|
|
1
|
+
/**
|
|
2
|
+
* Compare two file paths and simplify them to a relative path.
|
|
3
|
+
* @memberOf module:stringHelpers
|
|
4
|
+
* @param {string} fromFile - The path of the file the resulting relative path will be used from.
|
|
5
|
+
* @param {string} toFile - The path of the file being referenced.
|
|
6
|
+
* @return {string} `toFile` expressed relative to `fromFile`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const makeRelativePath: (fromFile: string, toFile: string) => string;
|
|
9
|
+
export default makeRelativePath;
|
|
10
10
|
//# sourceMappingURL=makeRelativePath.d.ts.map
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.makeRelativePath = exports.default = void 0
|
|
7
|
-
var _strBefore = _interopRequireDefault(require('./strBefore'))
|
|
8
|
-
var _strAfter = _interopRequireDefault(require('./strAfter'))
|
|
9
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
10
|
-
/**
|
|
11
|
-
* Compare two file paths and simplify them to a relative path.
|
|
12
|
-
* @memberOf module:stringHelpers
|
|
13
|
-
* @param {string} fromFile
|
|
14
|
-
* @param {string} toFile
|
|
15
|
-
* @return {string}
|
|
16
|
-
*/
|
|
17
|
-
const makeRelativePath = (fromFile, toFile) => {
|
|
18
|
-
let relativePath = toFile
|
|
19
|
-
let nextPart = fromFile
|
|
20
|
-
let firstPart = (0, _strBefore.default)(nextPart, '/')
|
|
21
|
-
let hasMatches = false
|
|
22
|
-
while (firstPart && relativePath.startsWith(firstPart)) {
|
|
23
|
-
relativePath = (0, _strAfter.default)(relativePath, `${firstPart}/`)
|
|
24
|
-
nextPart = (0, _strAfter.default)(nextPart, `${firstPart}/`)
|
|
25
|
-
firstPart = (0, _strBefore.default)(nextPart, '/')
|
|
26
|
-
hasMatches = true
|
|
27
|
-
}
|
|
28
|
-
if (!hasMatches) {
|
|
29
|
-
// No similar base paths, use the path as-is
|
|
30
|
-
return relativePath
|
|
31
|
-
}
|
|
32
|
-
let relativePrefix = ''
|
|
33
|
-
const nextParts = nextPart.split('/')
|
|
34
|
-
if (nextParts.length < 2) {
|
|
35
|
-
relativePrefix = './'
|
|
36
|
-
}
|
|
37
|
-
for (let i = 1; i < nextParts.length; ++i) {
|
|
38
|
-
relativePrefix += '../'
|
|
39
|
-
}
|
|
40
|
-
return relativePrefix + relativePath
|
|
41
|
-
}
|
|
42
|
-
exports.makeRelativePath = makeRelativePath
|
|
43
|
-
var _default = exports.default = makeRelativePath
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.makeRelativePath = exports.default = void 0
|
|
7
|
+
var _strBefore = _interopRequireDefault(require('./strBefore'))
|
|
8
|
+
var _strAfter = _interopRequireDefault(require('./strAfter'))
|
|
9
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
10
|
+
/**
|
|
11
|
+
* Compare two file paths and simplify them to a relative path.
|
|
12
|
+
* @memberOf module:stringHelpers
|
|
13
|
+
* @param {string} fromFile - The path of the file the resulting relative path will be used from.
|
|
14
|
+
* @param {string} toFile - The path of the file being referenced.
|
|
15
|
+
* @return {string} `toFile` expressed relative to `fromFile`.
|
|
16
|
+
*/
|
|
17
|
+
const makeRelativePath = (fromFile, toFile) => {
|
|
18
|
+
let relativePath = toFile
|
|
19
|
+
let nextPart = fromFile
|
|
20
|
+
let firstPart = (0, _strBefore.default)(nextPart, '/')
|
|
21
|
+
let hasMatches = false
|
|
22
|
+
while (firstPart && relativePath.startsWith(firstPart)) {
|
|
23
|
+
relativePath = (0, _strAfter.default)(relativePath, `${firstPart}/`)
|
|
24
|
+
nextPart = (0, _strAfter.default)(nextPart, `${firstPart}/`)
|
|
25
|
+
firstPart = (0, _strBefore.default)(nextPart, '/')
|
|
26
|
+
hasMatches = true
|
|
27
|
+
}
|
|
28
|
+
if (!hasMatches) {
|
|
29
|
+
// No similar base paths, use the path as-is
|
|
30
|
+
return relativePath
|
|
31
|
+
}
|
|
32
|
+
let relativePrefix = ''
|
|
33
|
+
const nextParts = nextPart.split('/')
|
|
34
|
+
if (nextParts.length < 2) {
|
|
35
|
+
relativePrefix = './'
|
|
36
|
+
}
|
|
37
|
+
for (let i = 1; i < nextParts.length; ++i) {
|
|
38
|
+
relativePrefix += '../'
|
|
39
|
+
}
|
|
40
|
+
return relativePrefix + relativePath
|
|
41
|
+
}
|
|
42
|
+
exports.makeRelativePath = makeRelativePath
|
|
43
|
+
var _default = exports.default = makeRelativePath
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Take a string and escape the regex characters.
|
|
3
|
-
* @memberOf module:stringHelpers
|
|
4
|
-
* @param {string} str
|
|
5
|
-
* @returns {string}
|
|
6
|
-
*/
|
|
7
|
-
export declare const regexEscape: (str: string) => string;
|
|
8
|
-
export default regexEscape;
|
|
1
|
+
/**
|
|
2
|
+
* Take a string and escape the regex characters.
|
|
3
|
+
* @memberOf module:stringHelpers
|
|
4
|
+
* @param {string} str - The string to escape, so it can be used literally inside a `RegExp`.
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export declare const regexEscape: (str: string) => string;
|
|
8
|
+
export default regexEscape;
|
|
9
9
|
//# sourceMappingURL=regexEscape.d.ts.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.regexEscape = exports.default = void 0
|
|
7
|
-
/**
|
|
8
|
-
* Take a string and escape the regex characters.
|
|
9
|
-
* @memberOf module:stringHelpers
|
|
10
|
-
* @param {string} str
|
|
11
|
-
* @returns {string}
|
|
12
|
-
*/
|
|
13
|
-
const regexEscape = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
14
|
-
exports.regexEscape = regexEscape
|
|
15
|
-
var _default = exports.default = regexEscape
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.regexEscape = exports.default = void 0
|
|
7
|
+
/**
|
|
8
|
+
* Take a string and escape the regex characters.
|
|
9
|
+
* @memberOf module:stringHelpers
|
|
10
|
+
* @param {string} str - The string to escape, so it can be used literally inside a `RegExp`.
|
|
11
|
+
* @returns {string}
|
|
12
|
+
*/
|
|
13
|
+
const regexEscape = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
14
|
+
exports.regexEscape = regexEscape
|
|
15
|
+
var _default = exports.default = regexEscape
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
/**
|
|
3
|
-
* Given a string in kebab-case, camelCase or 'Sentence case', convert to snake_case.
|
|
4
|
-
* @memberOf module:stringHelpers
|
|
5
|
-
* @param {string} str
|
|
6
|
-
* @returns {string}
|
|
7
|
-
*/
|
|
8
|
-
declare const snakeCase: (str: string) => string;
|
|
9
|
-
export default snakeCase;
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Given a string in kebab-case, camelCase or 'Sentence case', convert to snake_case.
|
|
4
|
+
* @memberOf module:stringHelpers
|
|
5
|
+
* @param {string} str - The string to convert.
|
|
6
|
+
* @returns {string}
|
|
7
|
+
*/
|
|
8
|
+
declare const snakeCase: (str: string) => string;
|
|
9
|
+
export default snakeCase;
|
|
10
10
|
//# sourceMappingURL=snakeCase.d.ts.map
|