
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
A simple conversion tool from one object type to the next
$ npm i convertify --save
// ES2015
import to from "convertify";
// CommonJS
const to = require("convertify");
// script
const to = window.convertify;
Or you can bring in individual functions:
// in this case toString, which is the same as to.string
// ES2015
import { toString } from "convertify";
// CommonJS
const toString = require("convertify").toString;
// script
const toString = window.convertify.toString;
const someObject = {
foo: "bar"
};
// you can use the default method
const map = to("map", someObject); // Map {'foo' => 'bar'}
// or the convenience methods
const array = to.array(map); // ['bar']
Link here: API
to(convertTo: string, object: any)
The standard method accepts two parameters, the first being a string of the object class you wnat to convert the object to, and the second being the object itself. The valid object classes you can convert to:
array
boolean
date
error
function
generator
map
null
number
object
promise
regexp
set
string
symbol
undefined
These values are either the string value you pass in as the first parameter to to
, or the shorthand method name for that specific conversion:
const stringifiedObject = to("string", object);
// is the same as
const alsoStringifiedObject = to.string(object);
The conversions themselves try to be smarter than the standard implicit conversions, so check out the API to learn more details about specific conversion results.
Standard stuff, clone the repo and npm i
to get the dependencies. npm scripts available:
build
=> builds the distributed JS with NODE_ENV=development
and with sourcemapsbuild-minified
=> builds the distributed JS with NODE_ENV=production
and minifiedcompile-for-publish
=> runs the lint
, test
, transpile
, build
, and build-minified
scriptsdev
=> runs the webpack dev server for the playgroundlint
=> runs ESLint against files in the src
folderprepublish
=> if in publish, runs compile-for-publish
test
=> run ava with NODE_ENV=testtest:watch
=> runs test
but with persistent watchertranspile
=> runs Babel against files in src
to files in lib
1.0.4
webpack-dev-server
fast-stringify
for handling circular objects when stringifyingFAQs
A simple convesion tool from one object type to the next
The npm package convertify receives a total of 2 weekly downloads. As such, convertify popularity was classified as not popular.
We found that convertify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.