Comparing version 1.0.2 to 2.0.0
@@ -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; |
@@ -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; |
{ | ||
"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" | ||
} | ||
} |
/* 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 */ |
/* 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 @@ |
{ | ||
"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" | ||
} |
Sorry, the diff of this file is not supported yet
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
Yes
4453
65
2
1