@bbn/bbn 1.0.281 → 1.0.283
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/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/fn/string/cast.d.ts +16 -0
- package/dist/fn/string/cast.js +32 -0
- package/dist/fn.d.ts +2 -0
- package/dist/fn.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a string from whatever value.
|
|
3
|
+
*
|
|
4
|
+
* @method cast
|
|
5
|
+
* @global
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* bbn.fn.nl2br('hello \n world!');
|
|
10
|
+
* //"hello <br> world!"
|
|
11
|
+
* ```
|
|
12
|
+
* @memberof bbn.fn
|
|
13
|
+
* @param {String} st
|
|
14
|
+
* @returns {String}
|
|
15
|
+
*/
|
|
16
|
+
export default function cast(st: any): any;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a string from whatever value.
|
|
3
|
+
*
|
|
4
|
+
* @method cast
|
|
5
|
+
* @global
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* bbn.fn.nl2br('hello \n world!');
|
|
10
|
+
* //"hello <br> world!"
|
|
11
|
+
* ```
|
|
12
|
+
* @memberof bbn.fn
|
|
13
|
+
* @param {String} st
|
|
14
|
+
* @returns {String}
|
|
15
|
+
*/
|
|
16
|
+
export default function cast(st) {
|
|
17
|
+
var _a;
|
|
18
|
+
if (!st) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
if (typeof st === 'object') {
|
|
22
|
+
if (bbn.fn.isArray(st)) {
|
|
23
|
+
return 'Array (' + st.length + ')';
|
|
24
|
+
}
|
|
25
|
+
return ((_a = st.constructor) === null || _a === void 0 ? void 0 : _a.name) || '{}';
|
|
26
|
+
}
|
|
27
|
+
if (st.toString) {
|
|
28
|
+
return st.toString();
|
|
29
|
+
}
|
|
30
|
+
return typeof st === 'string' ? st : '';
|
|
31
|
+
}
|
|
32
|
+
;
|
package/dist/fn.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import callback from './fn/ajax/callback.js';
|
|
|
22
22
|
import camelize from './fn/string/camelize.js';
|
|
23
23
|
import camelToCss from './fn/string/camelToCss.js';
|
|
24
24
|
import canvasToImage from './fn/convert/canvasToImage.js';
|
|
25
|
+
import cast from './fn/string/cast.js';
|
|
25
26
|
import center from './fn/style/center.js';
|
|
26
27
|
import checkProps from './fn/object/checkProps.js';
|
|
27
28
|
import checkPropsDetails from './fn/object/checkPropsDetails.js';
|
|
@@ -258,6 +259,7 @@ declare const _default: {
|
|
|
258
259
|
camelize: typeof camelize;
|
|
259
260
|
camelToCss: typeof camelToCss;
|
|
260
261
|
canvasToImage: typeof canvasToImage;
|
|
262
|
+
cast: typeof cast;
|
|
261
263
|
center: typeof center;
|
|
262
264
|
checkProps: typeof checkProps;
|
|
263
265
|
checkPropsDetails: typeof checkPropsDetails;
|
package/dist/fn.js
CHANGED
|
@@ -22,6 +22,7 @@ import callback from './fn/ajax/callback.js';
|
|
|
22
22
|
import camelize from './fn/string/camelize.js';
|
|
23
23
|
import camelToCss from './fn/string/camelToCss.js';
|
|
24
24
|
import canvasToImage from './fn/convert/canvasToImage.js';
|
|
25
|
+
import cast from './fn/string/cast.js';
|
|
25
26
|
import center from './fn/style/center.js';
|
|
26
27
|
import checkProps from './fn/object/checkProps.js';
|
|
27
28
|
import checkPropsDetails from './fn/object/checkPropsDetails.js';
|
|
@@ -258,6 +259,7 @@ export default {
|
|
|
258
259
|
camelize: camelize,
|
|
259
260
|
camelToCss: camelToCss,
|
|
260
261
|
canvasToImage: canvasToImage,
|
|
262
|
+
cast: cast,
|
|
261
263
|
center: center,
|
|
262
264
|
checkProps: checkProps,
|
|
263
265
|
checkPropsDetails: checkPropsDetails,
|