js-methods-npm
v1.2.0
Published
- 示例
Downloads
13
Readme
- 示例
/**
* @ObjectWrap 对象转数组
* @arrayObject 数组转对象
* @url_string 对象 转 url 参数字符串
* @requestUrl_object url参数转对象
*/
var METHODS = require("js-methods-npm");
const object = { a: "b", b: "c" };
METHODS.ObjectWrap(object, "name", "age"); // [ { name: 'a', age: 'b' }, { name: 'b', age: 'c' } ]
const array = [
{ name: "a", age: "b" },
{ name: "b", age: "c" },
];
METHODS.arrayObject(array, "name", "age"); // { a: 'b', b: 'c' }
const form = {
a: "b",
b: {
c: "ccc",
},
};
METHODS.url_string(object); // ?a=b&b=c&
METHODS.requestUrl_object("?fr=aladdin&id=%22123456%22&name=%22www%22"); // { fr: 'aladdin', id: '"123456"', name: '"www"' }