codsen-utils 1.0.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 1.0.1 (2022-12-22)
7
+
8
+ ### Bug Fixes
9
+
10
+ - init ([5e94b0d](https://github.com/codsen/codsen/commit/5e94b0d27d94c50dd337819279ab2e7aa082c57f))
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ <h1 align="center">codsen-utils</h1>
2
+
3
+ <p align="center">Various utility functions</p>
4
+
5
+ <p align="center">
6
+ <a href="https://codsen.com/os/codsen-utils" rel="nofollow noreferrer noopener">
7
+ <img src="https://img.shields.io/badge/-codsen-blue?style=flat-square" alt="page on codsen.com">
8
+ </a>
9
+ <a href="https://www.npmjs.com/package/codsen-utils" rel="nofollow noreferrer noopener">
10
+ <img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
11
+ </a>
12
+ <a href="https://github.com/codsen/codsen/tree/main/packages/codsen-utils" rel="nofollow noreferrer noopener">
13
+ <img src="https://img.shields.io/badge/-github-blue?style=flat-square" alt="page on github">
14
+ </a>
15
+ <a href="https://npmcharts.com/compare/codsen-utils?interval=30" rel="nofollow noreferrer noopener" target="_blank">
16
+ <img src="https://img.shields.io/npm/dm/codsen-utils.svg?style=flat-square" alt="Downloads per month">
17
+ </a>
18
+ <a href="https://codsen.com/os/codsen-utils/changelog" rel="nofollow noreferrer noopener">
19
+ <img src="https://img.shields.io/badge/changelog-here-brightgreen?style=flat-square" alt="changelog">
20
+ </a>
21
+ <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
22
+ </p>
23
+
24
+ ## Install
25
+
26
+ This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
27
+
28
+ ```bash
29
+ npm i codsen-utils
30
+ ```
31
+
32
+ ## Quick Take
33
+
34
+ ```js
35
+ import { strict as assert } from "assert";
36
+
37
+ import { isNumberChar } from "codsen-utils";
38
+
39
+ assert.equal(isNumberChar("z"), false);
40
+ assert.equal(isNumberChar("0"), true);
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ Please [visit codsen.com](https://codsen.com/os/codsen-utils/) for a full description of the API.
46
+
47
+ ## Contributing
48
+
49
+ To report bugs or request features or assistance, [raise an issue](https://github.com/codsen/codsen/issues/new/choose) on GitHub.
50
+
51
+ ## Licence
52
+
53
+ MIT License.
54
+
55
+ Copyright © 2010-2022 Roy Revelt and other contributors.
56
+
57
+ <p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @name codsen-utils
3
+ * @fileoverview Various utility functions
4
+ * @version 1.0.1
5
+ * @author Roy Revelt, Codsen Ltd
6
+ * @license MIT
7
+ * {@link https://codsen.com/os/codsen-utils/}
8
+ */
9
+
10
+ var o="1.0.1";var l=o,s="\u2018",i="\u2019",p="\u201C",c="\u201D",a="\u2013",m="\u2014",b="\xA0",x="\u2026",f="\u200A",g="\u2032",h="\u2033",y="\\",w="\uFFFD",k="`",j=[".",",",";","!","?"];function C(t){return typeof t=="string"&&t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57}function r(t){return typeof t=="string"&&t.length===1&&t.toUpperCase()!==t.toLowerCase()}function A(t){return!!(t&&typeof t=="string"&&(t.charCodeAt(0)>64&&t.charCodeAt(0)<91||t.charCodeAt(0)>96&&t.charCodeAt(0)<123))}function L(t){return typeof t=="string"&&(t==='"'||t==="'"||t===s||t===i||t===p||t===c)}function D(t){return typeof t!="string"||!r(t)?!1:t===t.toLowerCase()&&t!==t.toUpperCase()}function S(t){return typeof t!="string"||!r(t)?!1:t===t.toUpperCase()&&t!==t.toLowerCase()}var T=t=>typeof t=="string"&&t.length&&t.endsWith("/")?t.slice(0,-1).trim():t;function O(t){if(t==null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:!(Symbol.iterator in t)&&!(Symbol.toStringTag in t)}var P=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Q=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);export{y as backslash,k as backtick,h as doublePrime,Q as inlineTags,A as isLatinLetter,r as isLetter,D as isLowercaseLetter,C as isNumberChar,O as isPlainObject,L as isQuote,S as isUppercaseLetter,p as leftDoubleQuote,s as leftSingleQuote,j as punctuationChars,x as rawEllipsis,f as rawHairspace,m as rawMDash,a as rawNDash,b as rawNbsp,w as rawReplacementMark,T as removeTrailingSlash,c as rightDoubleQuote,i as rightSingleQuote,g as singlePrime,l as version,P as voidTags};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @name codsen-utils
3
+ * @fileoverview Various utility functions
4
+ * @version 1.0.1
5
+ * @author Roy Revelt, Codsen Ltd
6
+ * @license MIT
7
+ * {@link https://codsen.com/os/codsen-utils/}
8
+ */
9
+
10
+ "use strict";var codsenUtils=(()=>{var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var x=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},f=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of m(e))!b.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(i=a(e,o))||i.enumerable});return t};var g=t=>f(n({},"__esModule",{value:!0}),t);var H={};x(H,{backslash:()=>S,backtick:()=>O,doublePrime:()=>D,inlineTags:()=>q,isLatinLetter:()=>E,isLetter:()=>s,isLowercaseLetter:()=>R,isNumberChar:()=>Q,isPlainObject:()=>N,isQuote:()=>M,isUppercaseLetter:()=>U,leftDoubleQuote:()=>d,leftSingleQuote:()=>c,punctuationChars:()=>P,rawEllipsis:()=>C,rawHairspace:()=>A,rawMDash:()=>k,rawNDash:()=>w,rawNbsp:()=>j,rawReplacementMark:()=>T,removeTrailingSlash:()=>F,rightDoubleQuote:()=>l,rightSingleQuote:()=>u,singlePrime:()=>L,version:()=>y,voidTags:()=>V});var p="1.0.1";var y=p,c="\u2018",u="\u2019",d="\u201C",l="\u201D",w="\u2013",k="\u2014",j="\xA0",C="\u2026",A="\u200A",L="\u2032",D="\u2033",S="\\",T="\uFFFD",O="`",P=[".",",",";","!","?"];function Q(t){return typeof t=="string"&&t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57}function s(t){return typeof t=="string"&&t.length===1&&t.toUpperCase()!==t.toLowerCase()}function E(t){return!!(t&&typeof t=="string"&&(t.charCodeAt(0)>64&&t.charCodeAt(0)<91||t.charCodeAt(0)>96&&t.charCodeAt(0)<123))}function M(t){return typeof t=="string"&&(t==='"'||t==="'"||t===c||t===u||t===d||t===l)}function R(t){return typeof t!="string"||!s(t)?!1:t===t.toLowerCase()&&t!==t.toUpperCase()}function U(t){return typeof t!="string"||!s(t)?!1:t===t.toUpperCase()&&t!==t.toLowerCase()}var F=t=>typeof t=="string"&&t.length&&t.endsWith("/")?t.slice(0,-1).trim():t;function N(t){if(t==null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:!(Symbol.iterator in t)&&!(Symbol.toStringTag in t)}var V=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],q=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);return g(H);})();
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "codsen-utils",
3
+ "version": "1.0.1",
4
+ "description": "Various utility functions",
5
+ "keywords": [
6
+ "codsen",
7
+ "utility",
8
+ "helpers"
9
+ ],
10
+ "homepage": "https://codsen.com/os/codsen-utils",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/codsen/codsen.git",
14
+ "directory": "packages/codsen-utils"
15
+ },
16
+ "license": "MIT",
17
+ "author": {
18
+ "name": "Roy Revelt",
19
+ "email": "roy@codsen.com",
20
+ "url": "https://codsen.com"
21
+ },
22
+ "type": "module",
23
+ "exports": {
24
+ "types": "./types/index.d.ts",
25
+ "script": "./dist/codsen-utils.umd.js",
26
+ "default": "./dist/codsen-utils.esm.js"
27
+ },
28
+ "types": "types/index.d.ts",
29
+ "scripts": {
30
+ "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
31
+ "cjs-off": "exit 0",
32
+ "cjs-on": "exit 0",
33
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
34
+ "devtest": "c8 npm run unit && npm run examples && npm run lint",
35
+ "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --loglevel 'silent'",
36
+ "examples": "node '../../ops/scripts/run-examples.js'",
37
+ "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
38
+ "letspublish": "npm publish || :",
39
+ "lint": "eslint . --ext .js --ext .ts --fix",
40
+ "perf": "node perf/check.js",
41
+ "prep": "echo 'ready'",
42
+ "prettier": "prettier",
43
+ "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --loglevel 'silent'",
44
+ "pretest": "npm run lect && npm run build",
45
+ "test": "npm run devtest",
46
+ "unit": "uvu test"
47
+ },
48
+ "engines": {
49
+ "node": ">=14.18.0"
50
+ },
51
+ "c8": {
52
+ "check-coverage": true,
53
+ "exclude": [
54
+ "**/test/**/*.*"
55
+ ],
56
+ "functions": 100,
57
+ "lines": 100
58
+ },
59
+ "lect": {
60
+ "licence": {
61
+ "extras": [
62
+ ""
63
+ ]
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,61 @@
1
+ declare const version: string;
2
+ declare const leftSingleQuote = "\u2018";
3
+ declare const rightSingleQuote = "\u2019";
4
+ declare const leftDoubleQuote = "\u201C";
5
+ declare const rightDoubleQuote = "\u201D";
6
+ declare const rawNDash = "\u2013";
7
+ declare const rawMDash = "\u2014";
8
+ declare const rawNbsp = "\u00A0";
9
+ declare const rawEllipsis = "\u2026";
10
+ declare const rawHairspace = "\u200A";
11
+ declare const singlePrime = "\u2032";
12
+ declare const doublePrime = "\u2033";
13
+ declare const backslash = "\\";
14
+ declare const rawReplacementMark = "\uFFFD";
15
+ declare const backtick = "`";
16
+ declare const punctuationChars: string[];
17
+ declare function isNumberChar(value: unknown): boolean;
18
+ declare function isLetter(value: unknown): boolean;
19
+ declare function isLatinLetter(value: unknown): boolean;
20
+ declare function isQuote(value: unknown): boolean;
21
+ declare function isLowercaseLetter(value: unknown): boolean;
22
+ declare function isUppercaseLetter(value: unknown): boolean;
23
+ declare const removeTrailingSlash: <T>(value: T) => string | T;
24
+ /**
25
+ * Tells, is given input a plain object (an object literal,
26
+ * a container object Object.create(null) or created by new Object())
27
+ * @param value unknown
28
+ * @returns boolean
29
+ */
30
+ declare function isPlainObject(value: unknown): boolean;
31
+ declare const voidTags: string[];
32
+ declare const inlineTags: Set<string>;
33
+
34
+ export {
35
+ backslash,
36
+ backtick,
37
+ doublePrime,
38
+ inlineTags,
39
+ isLatinLetter,
40
+ isLetter,
41
+ isLowercaseLetter,
42
+ isNumberChar,
43
+ isPlainObject,
44
+ isQuote,
45
+ isUppercaseLetter,
46
+ leftDoubleQuote,
47
+ leftSingleQuote,
48
+ punctuationChars,
49
+ rawEllipsis,
50
+ rawHairspace,
51
+ rawMDash,
52
+ rawNDash,
53
+ rawNbsp,
54
+ rawReplacementMark,
55
+ removeTrailingSlash,
56
+ rightDoubleQuote,
57
+ rightSingleQuote,
58
+ singlePrime,
59
+ version,
60
+ voidTags,
61
+ };