Sorry, the diff of this file is not supported yet
+43
| # Noop Tag | ||
| A noop template literal tag, useful for syntax highlighting hints. | ||
| This package is basically a clone of [fake-tag](https://github.com/jaydenseric/fake-tag), but about 2\~4x faster, it is still 5\~10x slower than untagged template literals though, so you might want to use comment tags instead. | ||
| This overhead could be removed entirely via a babel transform that removes these noop tags from template literals, do you want to code it? | ||
| ## Install | ||
| ```sh | ||
| npm install --save noop-tag | ||
| ``` | ||
| ## Usage | ||
| ```ts | ||
| import css from 'noop-tag'; | ||
| import javascript from 'noop-tag'; | ||
| import html from 'noop-tag'; | ||
| const x = css` | ||
| .foo { | ||
| color: red; | ||
| } | ||
| `; | ||
| const y = javascript` | ||
| function () { | ||
| return 123; | ||
| } | ||
| `; | ||
| const z = html` | ||
| <div> | ||
| <b>Bold</b> | ||
| </div> | ||
| `; | ||
| ``` | ||
| ## License | ||
| MIT © Fabio Spampinato |
+0
-3
@@ -11,4 +11,1 @@ | ||
| trim_trailing_whitespace = true | ||
| [*.md] | ||
| trim_trailing_whitespace = false |
+2
-8
@@ -1,8 +0,2 @@ | ||
| declare function noop(strings: TemplateStringsArray, ...exp: any[]): string; | ||
| declare const _default: typeof noop & { | ||
| default: typeof noop; | ||
| } | ||
| declare namespace _default { | ||
| export type type = noop; | ||
| } | ||
| export = _default; | ||
| declare const noop: (strings: TemplateStringsArray, ...expressions: unknown[]) => string; | ||
| export default noop; |
+9
-22
@@ -1,24 +0,11 @@ | ||
| "use strict"; | ||
| /* NOOP */ | ||
| function noop(strings) { | ||
| var exp = []; | ||
| for (var _i = 1; _i < arguments.length; _i++) { | ||
| exp[_i - 1] = arguments[_i]; | ||
| /* MAIN */ | ||
| const noop = (strings, ...expressions) => { | ||
| let result = strings[0]; | ||
| for (let i = 1, l = strings.length; i < l; i++) { | ||
| result += expressions[i - 1]; | ||
| result += strings[i]; | ||
| } | ||
| var lastIndex = strings.length - 1; | ||
| if (!lastIndex) | ||
| return strings[0]; | ||
| var acc = '', part; | ||
| for (var i = 0; i < lastIndex; i++) { | ||
| part = strings[i]; | ||
| if (part) | ||
| acc += part; | ||
| acc += exp[i]; | ||
| } | ||
| part = strings[lastIndex]; | ||
| return part ? acc += part : acc; | ||
| } | ||
| return result; | ||
| }; | ||
| /* EXPORT */ | ||
| module.exports = noop; | ||
| module.exports.default = noop; | ||
| Object.defineProperty(module.exports, "__esModule", { value: true }); | ||
| export default noop; |
+17
-40
| { | ||
| "name": "noop-tag", | ||
| "repository": "github:fabiospampinato/noop-tag", | ||
| "description": "A noop template literal tag, useful for syntax highlighting hints.", | ||
| "version": "1.0.2", | ||
| "version": "2.0.0", | ||
| "type": "module", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "exports": "./dist/index.js", | ||
| "types": "./dist/index.d.ts", | ||
| "scripts": { | ||
| "benchmark": "node tasks/benchmark.js", | ||
| "clean:dist": "rimraf dist", | ||
| "clean:coverage": "rimraf coverage .nyc_output", | ||
| "clean": "npm run clean:dist && npm run clean:coverage", | ||
| "compile": "tsc --skipLibCheck && tstei", | ||
| "compile:watch": "tsc --skipLibCheck --watch", | ||
| "test": "ava", | ||
| "test:watch": "ava --watch", | ||
| "coverage": "nyc --reporter=html ava", | ||
| "report": "nyc report", | ||
| "report:html": "open coverage/index.html", | ||
| "prepublishOnly": "npm run clean && npm run compile && npm run coverage" | ||
| "benchmark": "tsex benchmark", | ||
| "benchmark:watch": "tsex benchmark --watch", | ||
| "clean": "tsex clean", | ||
| "compile": "tsex compile", | ||
| "compile:watch": "tsex compile --watch", | ||
| "test": "tsex test", | ||
| "test:watch": "tsex test --watch", | ||
| "prepublishOnly": "npm run clean && npm run compile && npm run test" | ||
| }, | ||
| "ava": { | ||
| "files": [ | ||
| "test/index.js" | ||
| ] | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/fabiospampinato/noop-tag/issues" | ||
| }, | ||
| "license": "MIT", | ||
| "author": { | ||
| "name": "Fabio Spampinato", | ||
| "email": "spampinabio@gmail.com" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/fabiospampinato/noop-tag.git" | ||
| }, | ||
| "keywords": [ | ||
@@ -45,13 +27,8 @@ "template", | ||
| ], | ||
| "dependencies": {}, | ||
| "devDependencies": { | ||
| "@types/node": "^13.5.0", | ||
| "ava": "^2.3.0", | ||
| "ava-spec": "^1.1.1", | ||
| "nyc": "^15.0.0", | ||
| "benchloop": "^1.3.1", | ||
| "rimraf": "^3.0.0", | ||
| "typescript": "^3.7.5", | ||
| "typescript-transform-export-interop": "^1.0.2" | ||
| "benchloop": "^1.3.2", | ||
| "fava": "^0.0.6", | ||
| "tsex": "^1.0.4", | ||
| "typescript": "^4.6.3" | ||
| } | ||
| } |
+8
-18
| /* NOOP */ | ||
| /* MAIN */ | ||
| function noop ( strings: TemplateStringsArray, ...exp: any[] ): string { | ||
| const noop = ( strings: TemplateStringsArray, ...expressions: unknown[] ): string => { | ||
| const lastIndex = strings.length - 1; | ||
| let result = strings[0]; | ||
| if ( !lastIndex ) return strings[0]; | ||
| for ( let i = 1, l = strings.length; i < l; i++ ) { | ||
| let acc = '', | ||
| part; | ||
| result += expressions[i - 1]; | ||
| result += strings[i]; | ||
| for ( let i = 0; i < lastIndex; i++ ) { | ||
| part = strings[i]; | ||
| if ( part ) acc += part; | ||
| acc += exp[i]; | ||
| } | ||
| part = strings[lastIndex]; | ||
| return result; | ||
| return part ? acc += part : acc; | ||
| }; | ||
| } | ||
| /* EXPORT */ | ||
| export default noop; |
| /* IMPORT */ | ||
| const {default: noop} = require ( '../dist' ), | ||
| benchmark = require ( 'benchloop' ); | ||
| import benchmark from 'benchloop'; | ||
| import noop from '../dist/index.js'; | ||
@@ -7,0 +7,0 @@ /* BENCHMARK */ |
+5
-3
| /* IMPORT */ | ||
| import {describe} from 'ava-spec'; | ||
| import {default as noop} from '../dist'; | ||
| import {describe} from 'fava'; | ||
| import noop from '../dist/index.js'; | ||
| /* NOOP TAG */ | ||
| /* MAIN */ | ||
@@ -23,3 +23,5 @@ describe ( 'Noop Tag', it => { | ||
| tests.forEach ( ([ result, expected ]) => { | ||
| t.is ( result, expected ); | ||
| }); | ||
@@ -26,0 +28,0 @@ |
+1
-26
| { | ||
| "compilerOptions": { | ||
| "alwaysStrict": true, | ||
| "declaration": true, | ||
| "emitDecoratorMetadata": true, | ||
| "experimentalDecorators": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "inlineSourceMap": false, | ||
| "jsx": "react", | ||
| "lib": ["dom", "scripthost", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020"], | ||
| "module": "commonjs", | ||
| "moduleResolution": "node", | ||
| "newLine": "LF", | ||
| "noFallthroughCasesInSwitch": true, | ||
| "noUnusedLocals": true, | ||
| "noUnusedParameters": false, | ||
| "outDir": "dist", | ||
| "pretty": true, | ||
| "strictNullChecks": true, | ||
| "target": "es5" | ||
| }, | ||
| "include": [ | ||
| "src" | ||
| ], | ||
| "exclude": [ | ||
| "node_modules" | ||
| ] | ||
| "extends": "tsex/tsconfig.json" | ||
| } |
-21
| The MIT License (MIT) | ||
| Copyright (c) 2020-present Fabio Spampinato | ||
| Permission is hereby granted, free of charge, to any person obtaining a | ||
| copy of this software and associated documentation files (the "Software"), | ||
| to deal in the Software without restriction, including without limitation | ||
| the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| and/or sell copies of the Software, and to permit persons to whom the | ||
| Software is furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| DEALINGS IN THE SOFTWARE. |
-43
| # Noop Tag | ||
| A noop template literal tag, useful for syntax highlighting hints. | ||
| This package is basically a clone of [fake-tag](https://github.com/jaydenseric/fake-tag), but about 2\~4x faster, it is still 5\~10x slower than untagged template literals though, so you might want to use comment tags instead. | ||
| This overhead could be removed entirely via a babel transform that removes these noop tags from template literals, do you want to code it? | ||
| ## Install | ||
| ```sh | ||
| npm install --save noop-tag | ||
| ``` | ||
| ## Usage | ||
| ```ts | ||
| import css from 'noop-tag'; | ||
| import javascript from 'noop-tag'; | ||
| import html from 'noop-tag'; | ||
| const x = css` | ||
| .foo { | ||
| color: red; | ||
| } | ||
| `; | ||
| const y = javascript` | ||
| function () { | ||
| return 123; | ||
| } | ||
| `; | ||
| const z = html` | ||
| <div> | ||
| <b>Bold</b> | ||
| </div> | ||
| `; | ||
| ``` | ||
| ## License | ||
| MIT © Fabio Spampinato |
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4
-50%Yes
NaN4453
-29.96%65
-42.98%2
Infinity%1
Infinity%