@teambit/toolbox.string.get-initials 0.0.498 → 0.0.500
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/get-initials.d.ts +1 -1
- package/dist/get-initials.js +12 -13
- package/dist/get-initials.js.map +1 -1
- package/dist/get-initials.spec.js +25 -11
- package/dist/get-initials.spec.js.map +1 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/get-initials.spec.ts +4 -3
- package/package.json +5 -5
- package/types/asset.d.ts +15 -3
- package/dist/preview-1733851236714.js +0 -7
package/dist/get-initials.d.ts
CHANGED
package/dist/get-initials.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getInitials = getInitials;
|
|
4
7
|
/**
|
|
5
8
|
* return the initials of a string if possible.
|
|
6
9
|
* @param name string to get initials from
|
|
7
10
|
*/
|
|
8
11
|
function getInitials(name) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.map((word) => word[0])
|
|
16
|
-
.join('');
|
|
17
|
-
}
|
|
18
|
-
return name.slice(0, 2);
|
|
12
|
+
if (!name) return undefined;
|
|
13
|
+
const words = name.split(' ');
|
|
14
|
+
if (words.length > 1) {
|
|
15
|
+
return words.slice(0, 2).map(word => word[0]).join('');
|
|
16
|
+
}
|
|
17
|
+
return name.slice(0, 2);
|
|
19
18
|
}
|
|
20
|
-
|
|
19
|
+
|
|
21
20
|
//# sourceMappingURL=get-initials.js.map
|
package/dist/get-initials.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["getInitials","name","undefined","words","split","length","slice","map","word","join"],"sources":["get-initials.ts"],"sourcesContent":["/**\n * return the initials of a string if possible.\n * @param name string to get initials from\n */\nexport function getInitials(name: string) {\n if (!name) return undefined;\n\n const words = name.split(' ');\n if (words.length > 1) {\n return words\n .slice(0, 2)\n .map((word) => word[0])\n .join('');\n }\n return name.slice(0, 2);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAACC,IAAY,EAAE;EACxC,IAAI,CAACA,IAAI,EAAE,OAAOC,SAAS;EAE3B,MAAMC,KAAK,GAAGF,IAAI,CAACG,KAAK,CAAC,GAAG,CAAC;EAC7B,IAAID,KAAK,CAACE,MAAM,GAAG,CAAC,EAAE;IACpB,OAAOF,KAAK,CACTG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CACXC,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAAC,CAAC,CAAC,CAAC,CACtBC,IAAI,CAAC,EAAE,CAAC;EACb;EACA,OAAOR,IAAI,CAACK,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AACzB","ignoreList":[]}
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
function _getInitials() {
|
|
4
|
+
const data = require("./get-initials");
|
|
5
|
+
_getInitials = function () {
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
return data;
|
|
9
|
+
}
|
|
10
|
+
function _chai() {
|
|
11
|
+
const data = require("chai");
|
|
12
|
+
_chai = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
4
17
|
describe('getInitials()', () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
it('should return two letters for the initialsof two word', () => {
|
|
19
|
+
(0, _chai().expect)((0, _getInitials().getInitials)('scope name')).to.equal('sn');
|
|
20
|
+
});
|
|
21
|
+
it('should return the two first letters if one word', () => {
|
|
22
|
+
(0, _chai().expect)((0, _getInitials().getInitials)('scope')).to.equal('sc');
|
|
23
|
+
});
|
|
24
|
+
it('should return undefined if the word is empty', () => {
|
|
25
|
+
(0, _chai().expect)((0, _getInitials().getInitials)('')).to.be.undefined;
|
|
26
|
+
});
|
|
14
27
|
});
|
|
28
|
+
|
|
15
29
|
//# sourceMappingURL=get-initials.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_getInitials","data","require","_chai","describe","it","expect","getInitials","to","equal","be","undefined"],"sources":["get-initials.spec.ts"],"sourcesContent":["import { getInitials } from './get-initials';\nimport { expect } from 'chai';\n\ndescribe('getInitials()', () => {\n it('should return two letters for the initialsof two word', () => {\n expect(getInitials('scope name')).to.equal('sn');\n });\n\n it('should return the two first letters if one word', () => {\n expect(getInitials('scope')).to.equal('sc');\n });\n\n it('should return undefined if the word is empty', () => {\n expect(getInitials('')).to.be.undefined;\n });\n});\n"],"mappings":";;AAAA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEAG,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9BC,EAAE,CAAC,uDAAuD,EAAE,MAAM;IAChE,IAAAC,cAAM,EAAC,IAAAC,0BAAW,EAAC,YAAY,CAAC,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,IAAI,CAAC;EAClD,CAAC,CAAC;EAEFJ,EAAE,CAAC,iDAAiD,EAAE,MAAM;IAC1D,IAAAC,cAAM,EAAC,IAAAC,0BAAW,EAAC,OAAO,CAAC,CAAC,CAACC,EAAE,CAACC,KAAK,CAAC,IAAI,CAAC;EAC7C,CAAC,CAAC;EAEFJ,EAAE,CAAC,8CAA8C,EAAE,MAAM;IACvD,IAAAC,cAAM,EAAC,IAAAC,0BAAW,EAAC,EAAE,CAAC,CAAC,CAACC,EAAE,CAACE,EAAE,CAACC,SAAS;EACzC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "getInitials", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _getInitials().getInitials;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
function _getInitials() {
|
|
13
|
+
const data = require("./get-initials");
|
|
14
|
+
_getInitials = function () {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_getInitials","data","require"],"sources":["index.ts"],"sourcesContent":["export { getInitials } from './get-initials';\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,aAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,YAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
|
package/get-initials.spec.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { getInitials } from './get-initials';
|
|
2
|
+
import { expect } from 'chai';
|
|
2
3
|
|
|
3
4
|
describe('getInitials()', () => {
|
|
4
5
|
it('should return two letters for the initialsof two word', () => {
|
|
5
|
-
expect(getInitials('scope name')).
|
|
6
|
+
expect(getInitials('scope name')).to.equal('sn');
|
|
6
7
|
});
|
|
7
8
|
|
|
8
9
|
it('should return the two first letters if one word', () => {
|
|
9
|
-
expect(getInitials('scope')).
|
|
10
|
+
expect(getInitials('scope')).to.equal('sc');
|
|
10
11
|
});
|
|
11
12
|
|
|
12
13
|
it('should return undefined if the word is empty', () => {
|
|
13
|
-
expect(getInitials('')).
|
|
14
|
+
expect(getInitials('')).to.be.undefined;
|
|
14
15
|
});
|
|
15
16
|
});
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/toolbox.string.get-initials",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.500",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/toolbox/string/get-initials",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.toolbox",
|
|
8
8
|
"name": "string/get-initials",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.500"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {},
|
|
12
12
|
"devDependencies": {
|
|
13
|
+
"@types/chai": "4.2.15",
|
|
14
|
+
"chai": "4.3.0",
|
|
13
15
|
"@types/mocha": "9.1.0",
|
|
14
|
-
"@
|
|
15
|
-
"@types/node": "12.20.4",
|
|
16
|
-
"@babel/runtime": "7.20.0"
|
|
16
|
+
"@teambit/node.envs.node-babel-mocha": "0.1.4"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {},
|
|
19
19
|
"license": "Apache-2.0",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
29
|
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.toolbox_string_get-initials@0.0.498/dist/get-initials.docs.md';
|
|
3
|
-
|
|
4
|
-
export const compositions = [];
|
|
5
|
-
export const overview = [overview_0];
|
|
6
|
-
|
|
7
|
-
export const compositions_metadata = {"compositions":[]};
|