@bbn/bbn 1.0.280 → 1.0.282
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 +29 -0
- package/dist/fn/type/isSame.js +1 -1
- 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,29 @@
|
|
|
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 (st.toString) {
|
|
22
|
+
return st.toString();
|
|
23
|
+
}
|
|
24
|
+
if (typeof st === 'object') {
|
|
25
|
+
return ((_a = st.constructor) === null || _a === void 0 ? void 0 : _a.name) || '{}';
|
|
26
|
+
}
|
|
27
|
+
return typeof st === 'string' ? st : '';
|
|
28
|
+
}
|
|
29
|
+
;
|
package/dist/fn/type/isSame.js
CHANGED
|
@@ -68,7 +68,7 @@ export default function isSame(obj1, obj2, done) {
|
|
|
68
68
|
});
|
|
69
69
|
return ok_1;
|
|
70
70
|
}
|
|
71
|
-
else if (obj1 && obj2 && typeof obj1 === 'function' && typeof obj2 === 'function') {
|
|
71
|
+
else if (obj1 && obj2 && (typeof obj1 === 'function') && (typeof obj2 === 'function')) {
|
|
72
72
|
var tmp1 = analyzeFunction(obj1);
|
|
73
73
|
var tmp2 = analyzeFunction(obj2);
|
|
74
74
|
var isSame_1 = tmp1.hash === tmp2.hash;
|
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,
|