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

obj-str

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obj-str - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

dist/obj-str.mjs

6

dist/obj-str.js
module.exports = function (obj) {
var cls = '';
for (var k in obj) {
let cls = '';
for (const k in obj) {
if (obj[k]) {

@@ -10,2 +10,2 @@ cls && (cls += ' ');

return cls;
};
}

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

module.exports=function(obj){var cls='';for(var k in obj){if(obj[k]){cls&&(cls+=' ');cls+=k}}return cls}
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.objstr=t()}(this,function(){return function(n){let o="";for(const t in n)n[t]&&(o&&(o+=" "),o+=t);return o};});
{
"name": "obj-str",
"version": "1.0.1",
"version": "1.0.2",
"repository": "lukeed/obj-str",
"description": "A tiny library for serializing Object values to Strings.",
"module": "dist/obj-str.es.js",
"unpkg": "dist/obj-str.min.js",
"module": "dist/obj-str.mjs",
"main": "dist/obj-str.js",
"umd:name": "objstr",
"license": "MIT",

@@ -18,4 +20,5 @@ "author": {

"scripts": {
"build": "rollup -c",
"test": "xo && tape test/*.js | tap-spec"
"build": "node builder",
"pretest": "node builder",
"test": "tape test/*.js | tap-spec"
},

@@ -38,14 +41,9 @@ "files": [

"devDependencies": {
"rollup": "^0.41.6",
"gzip-size": "^5.0.0",
"mk-dirs": "^1.0.0",
"pretty-bytes": "^5.1.0",
"tap-spec": "^4.1.1",
"tape": "^4.6.3",
"xo": "^0.17.0"
},
"xo": {
"esnext": true,
"rules": {
"no-unused-expressions": 0,
"no-self-compare": 0
}
"terser": "^3.13.1"
}
}
# obj-str [![Build Status](https://travis-ci.org/lukeed/obj-str.svg?branch=master)](https://travis-ci.org/lukeed/obj-str)
> A tiny (117b) library for serializing Object values to Strings.
> A tiny (100B) library for serializing Object values to Strings.
This module's intended use is for converting an Object with CSS class names (as keys) to a space-delimited `className` string. Other modules have similar goals (like [`classnames`](https://npm.im/classnames)), but `obj-str` only does one thing. This is why it's only 117 bytes gzipped!
This module's intended use is for converting an Object with CSS class names (as keys) to a space-delimited `className` string. Other modules have similar goals (like [`classnames`](https://npm.im/classnames)), but `obj-str` only does one thing. This is why it's only 100 bytes gzipped!

@@ -77,4 +77,9 @@ _PS: I made this because [Preact 8.0 removed this built-in behavior](https://github.com/developit/preact/commit/b2c85e3f7fa89ebbf242b00f4cab7619641e3a52) and I wanted a quick, drop-in replacement._

## Related
- [clsx](https://github.com/lukeed/clsx) - Drop-in replacement for `obj-str` and `classnames` – handles all (and multiple) input types.
## License
MIT © [Luke Edwards](http://lukeed.com)
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