Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cnbuilder

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cnbuilder - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [3.1.0](https://github.com/xobotyi/cnbuilder/compare/v3.0.1...v3.1.0) (2021-12-27)
### Features
* enhance performance ([7aefefd](https://github.com/xobotyi/cnbuilder/commit/7aefefd2a3f9ee73326e32cf7b820a5b3a3280b2))
## [3.0.1](https://github.com/xobotyi/cnbuilder/compare/v3.0.0...v3.0.1) (2021-07-11)

@@ -2,0 +9,0 @@

58

cjs/cnb.js

@@ -6,20 +6,29 @@ "use strict";

var toClassName = function (val) {
var str = '';
if (typeof val === 'string')
return val;
if (typeof val !== 'object')
return '';
var str = '';
var tmp;
if (isArray(val)) {
var i = 0;
while (i < val.length) {
tmp = toClassName(val[i++]);
if (tmp)
str += (str && ' ') + tmp;
str += val;
else if (typeof val === 'object') {
var tmp = void 0;
if (isArray(val)) {
var i = 0;
var l = val.length;
while (i < l) {
tmp = toClassName(val[i++]);
if (tmp) {
if (str) {
str += ' ';
}
str += tmp;
}
}
}
}
else {
for (tmp in val) {
if (val[tmp] && tmp) {
str += (str && ' ') + tmp;
else {
// eslint-disable-next-line guard-for-in
for (tmp in val) {
if (tmp && val[tmp]) {
if (str) {
str += ' ';
}
str += tmp;
}
}

@@ -31,9 +40,18 @@ }

function cnb() {
var l = arguments.length;
var i = 0;
var n;
var tmp;
var str = '';
while (i < arguments.length) {
tmp = toClassName(arguments[i++]);
if (tmp)
str += (str && ' ') + tmp;
while (i < l) {
n = arguments[i++];
if (n) {
tmp = toClassName(n);
if (tmp) {
if (str) {
str += ' ';
}
str += tmp;
}
}
}

@@ -40,0 +58,0 @@ return str;

@@ -40,11 +40,17 @@ "use strict";

var i = 0;
while (i < arguments.length) {
var l = arguments.length;
while (i < l) {
addVal(arguments[i++], storage);
}
var str = '';
for (i in storage)
if (storage[i] && i)
str += (str && ' ') + i;
for (i in storage) {
if (storage[i] && i) {
if (str) {
str += ' ';
}
str += i;
}
}
return str;
}
exports.dcnb = dcnb;
var isArray = Array.isArray;
var toClassName = function (val) {
var str = '';
if (typeof val === 'string')
return val;
if (typeof val !== 'object')
return '';
var str = '';
var tmp;
if (isArray(val)) {
var i = 0;
while (i < val.length) {
tmp = toClassName(val[i++]);
if (tmp)
str += (str && ' ') + tmp;
str += val;
else if (typeof val === 'object') {
var tmp = void 0;
if (isArray(val)) {
var i = 0;
var l = val.length;
while (i < l) {
tmp = toClassName(val[i++]);
if (tmp) {
if (str) {
str += ' ';
}
str += tmp;
}
}
}
}
else {
for (tmp in val) {
if (val[tmp] && tmp) {
str += (str && ' ') + tmp;
else {
// eslint-disable-next-line guard-for-in
for (tmp in val) {
if (tmp && val[tmp]) {
if (str) {
str += ' ';
}
str += tmp;
}
}

@@ -27,11 +36,20 @@ }

export function cnb() {
var l = arguments.length;
var i = 0;
var n;
var tmp;
var str = '';
while (i < arguments.length) {
tmp = toClassName(arguments[i++]);
if (tmp)
str += (str && ' ') + tmp;
while (i < l) {
n = arguments[i++];
if (n) {
tmp = toClassName(n);
if (tmp) {
if (str) {
str += ' ';
}
str += tmp;
}
}
}
return str;
}

@@ -37,10 +37,16 @@ var SPACE_REGEX = /\s+/;

var i = 0;
while (i < arguments.length) {
var l = arguments.length;
while (i < l) {
addVal(arguments[i++], storage);
}
var str = '';
for (i in storage)
if (storage[i] && i)
str += (str && ' ') + i;
for (i in storage) {
if (storage[i] && i) {
if (str) {
str += ' ';
}
str += i;
}
}
return str;
}
const { isArray } = Array;
const toClassName = (val) => {
let str = '';
if (typeof val === 'string')
return val;
if (typeof val !== 'object')
return '';
let str = '';
let tmp;
if (isArray(val)) {
let i = 0;
while (i < val.length) {
tmp = toClassName(val[i++]);
if (tmp)
str += (str && ' ') + tmp;
str += val;
else if (typeof val === 'object') {
let tmp;
if (isArray(val)) {
let i = 0;
const l = val.length;
while (i < l) {
tmp = toClassName(val[i++]);
if (tmp) {
if (str) {
str += ' ';
}
str += tmp;
}
}
}
}
else {
for (tmp in val) {
if (val[tmp] && tmp) {
str += (str && ' ') + tmp;
else {
// eslint-disable-next-line guard-for-in
for (tmp in val) {
if (tmp && val[tmp]) {
if (str) {
str += ' ';
}
str += tmp;
}
}

@@ -27,11 +36,20 @@ }

export function cnb() {
const l = arguments.length;
let i = 0;
let n;
let tmp;
let str = '';
while (i < arguments.length) {
tmp = toClassName(arguments[i++]);
if (tmp)
str += (str && ' ') + tmp;
while (i < l) {
n = arguments[i++];
if (n) {
tmp = toClassName(n);
if (tmp) {
if (str) {
str += ' ';
}
str += tmp;
}
}
}
return str;
}

@@ -37,10 +37,16 @@ const SPACE_REGEX = /\s+/;

let i = 0;
while (i < arguments.length) {
const l = arguments.length;
while (i < l) {
addVal(arguments[i++], storage);
}
let str = '';
for (i in storage)
if (storage[i] && i)
str += (str && ' ') + i;
for (i in storage) {
if (storage[i] && i) {
if (str) {
str += ' ';
}
str += i;
}
}
return str;
}
{
"name": "cnbuilder",
"description": "Yet another classname string builder (the fastest one)",
"version": "3.0.1",
"version": "3.1.0",
"files": [

@@ -42,16 +42,16 @@ "cjs",

"@jamesacarr/jest-reporter-github-actions": "^0.0.4",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@semantic-release/npm": "^7.0.5",
"@types/jest": "^26.0.0",
"@xobotyi/eslint-config": "^2.2.0",
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@semantic-release/npm": "^8.0.0",
"@types/jest": "^27.0.0",
"@xobotyi/eslint-config": "^2.3.0",
"@xobotyi/preset-typescript": "^1.0.0",
"concurrently": "^6.2.0",
"eslint": "^7.0.0",
"husky": "4.3.8",
"eslint": "^8.5.0",
"husky": "7.0.4",
"jest": "^27.0.6",
"lint-staged": "^11.0.0",
"lint-staged": "^12.1.4",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"semantic-release": "^17.0.7",
"semantic-release": "^18.0.0",
"ts-jest": "^27.0.3",

@@ -63,2 +63,3 @@ "ts-node": "^10.1.0",

"scripts": {
"prepare": "husky install",
"build": "yarn build:cleanup && concurrently yarn:build:cjs yarn:build:esm yarn:build:esnext --kill-others-on-fail",

@@ -82,7 +83,2 @@ "build:cleanup": "rimraf ./cjs ./esm ./esnext ./types",

},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"release": {

@@ -89,0 +85,0 @@ "plugins": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc