@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.
@@ -2,4 +2,4 @@
2
2
  * return the initials of a string if possible.
3
3
  * @param name string to get initials from
4
4
  */
5
- export declare function getInitials(name: string): string;
5
+ export declare function getInitials(name: string): string | undefined;
@@ -1,21 +1,20 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInitials = void 0;
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
- if (!name)
10
- return undefined;
11
- const words = name.split(' ');
12
- if (words.length > 1) {
13
- return words
14
- .slice(0, 2)
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
- exports.getInitials = getInitials;
19
+
21
20
  //# sourceMappingURL=get-initials.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-initials.js","sourceRoot":"","sources":["../get-initials.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,SAAgB,WAAW,CAAC,IAAY;IACtC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAE5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK;aACT,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;aACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACtB,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1B,CAAC;AAXD,kCAWC"}
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
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const get_initials_1 = require("./get-initials");
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
- it('should return two letters for the initialsof two word', () => {
6
- expect((0, get_initials_1.getInitials)('scope name')).toEqual('sn');
7
- });
8
- it('should return the two first letters if one word', () => {
9
- expect((0, get_initials_1.getInitials)('scope')).toEqual('sc');
10
- });
11
- it('should return undefined if the word is empty', () => {
12
- expect((0, get_initials_1.getInitials)('')).toBeUndefined();
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,"file":"get-initials.spec.js","sourceRoot":"","sources":["../get-initials.spec.ts"],"names":[],"mappings":";;AAAA,iDAA6C;AAE7C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC/D,MAAM,CAAC,IAAA,0BAAW,EAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,CAAC,IAAA,0BAAW,EAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,IAAA,0BAAW,EAAC,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
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
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInitials = void 0;
4
- var get_initials_1 = require("./get-initials");
5
- Object.defineProperty(exports, "getInitials", { enumerable: true, get: function () { return get_initials_1.getInitials; } });
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,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA"}
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":[]}
@@ -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')).toEqual('sn');
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')).toEqual('sc');
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('')).toBeUndefined();
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.498",
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.498"
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
- "@types/jest": "26.0.20",
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<SVGProps<SVGSVGElement> & { title?: string }>;
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":[]};